It just occurred to me that the "Are you sure you want to quit/close/etc.?" features should be promoted to an OS (or desktop/platform) level concept. These things prevent log out, shut down, and so on. They can also cause other confusion when the system tries to guess if the software is behaving well.
Probably can't completely standardize the content of such quit confirmations, but some level of communication with the system about what's going on could make this user experience tons better.