Added WindowEvent handling to Quit for mainframe closing event