Can you add a warning if the player accidentally closes the window? (I was trying to click on the upper right corner, and misclicked on the ‘X’ close window instead). You can trap alt+F4 the same way, for players who play fullscreen. Fortunately I had a recent save maybe 5 minutes ago, but it could easily be a lot worse.
Just pop up a confirmation “are you sure you want to exit?” would be great. Thanks!