Prevent UnboundLocalErrors on empty loops.

If an empty loop occurs in the mouse_event or move_cursor_to_coords methods of
Pile, the variable w will not be defined, leading to an UnboundLocalError later
when those methods attempt to use it.  Set this variable to None and check its
value later to ensure that this error does not occur.