added calls to by command in mainwindow destructor