"Directional Switch" Design

A flipflop circuit is nice but will be plagued by contact bounce.

A switch could detect direction of motion by dragging a probe on the side of the drawer, closed only during drawer close. A simple cam could close and open another switch at the correct times.