Window close event.

Added window close event and Alt-F4 support.