Fixed code for closest pair of points