implement and test find-closet-centroids function