MathGolf, 10 bytes
∞╒g¶áÅ-±├Þ
Explanation:
∞ # Double the (implicit) input-integer
╒ # Create a list in the range [1, 2*n]
g¶ # Filter so only the prime numbers remain
áÅ # Sort this list using the next two character:
-± # The absolute difference with the (implicit) input-integer
├ # Push the first item of the list
# (unfortunately without popping the list itself, so:)
Þ # Discard everything from the stack except for the top
# (which is output implicitly as result)