Run dialogs after the GUI has been killed

This will make sure the dialogs do not hide under the GUI.