kdtree finalizing.