Fixed application being closed with the last visible dialog closed