fix bug in findClosestFile