handle mainwindow event "close"