Fix the window-close-database-shutdown behaviour that I broke in my eager refactoring.