Adding closing interception for qt main window