Adding WindowListener to catch close events from Frame and Menu