0fb34ed965
The program can get stuck waiting for the browser within a event queue, so instead mark that the program is closing, do it in a separate thread, signal the window when it's finished, and then check whether it's in the process of closing before actually showing the dialog.