find closet index