Nice solution. I took a similar approach using binary search, but instead started with a leftmost window of length k. I then move the window right while the element to the right of the window is closer to x than the first element of the window.

class Solution(object):
def findClosestElements(self, arr, k, x):
end = max(bisect.bisect_left(arr, x), k)
while end < len(arr) and abs(arr[end]-x) < abs(arr[end-k]-x):
end += 1
return arr[end-k:end]