Handling quit events cleanly outside of the event loop.
Unglobalizing all of the state.