Make sure we show the dialog and close application from the main loop and not from constructor