Fix bug in closesort()

closesort() was hitting an off-by-one error. Changing it to use
the closestpoint() function fixes it, and makes closesort() more
readable as a bonus.

This commit also separates the "draw this glyph/midline" code from
the "wait for keypress" code, so that we can superimpose two or
more sets of drawings (e.g., drawing the outline and triangles,
then later on drawing the midlines with a 0.1-second sleep in between
each segment so that we can watch it happen).