Hint 1
Will brute force work for this problem? Think of something else.
Hint 2
Take some examples like 1234, 999,1000, etc and check their closest palindromes. How many different cases are possible?
Hint 3
Do we have to consider only left half or right half of the string or both?
Hint 4
Try to find the closest palindrome of these numbers- 12932, 99800, 12120. Did you observe something?