Is there a way to enable "Are you sure you want to quit?"

Is there any way to have Blender give you a “Are you sure you want to quit?” (or similar) dialogue when you close the window or open a new file without having saved the current one? It’s weird not to have such a feature in such a high-quality program.

bad news: no.
good news: there is no way to disable the auto-save on exit feature, either. http://wiki.blender.org/index.php/Manual/The_Vital_Functions and the next few pages. When you exit, quit.blend is always written out to your temp directory.

Guy de Vere, There are a few ways to protect your work from accidental closing.
As PapaSmurf said, Blender autosaves on quit. (windows C/tmp), you can change this directory in the file settings. (pull down top preferences menu). The other way is to set auto save to save every few minutes, make sure you create the folder to save to, set autosave for every 3 min, then your pretty safe.
If you are running multiple versions of Blender you can change the file directory’s in the preferences menu’s press ctrl/u to save so as not to overwritefiles from different versions.
If you accidentally, close re-open Blender then press ‘recover last session’ this usually works well.
The best practice is to save your work regularly, when you make some changes to your blend, save, save, save. Mymodel1, Mymodel2, Mymodel3. This way if you make a mistake or want to go back & redesign or Blender crashes, you will always have plenty of saves to work from.
I do agree that it is strange that such a universal function such as ‘Would you like to save before quitting’ is not in Blender, it is in many other open source programs, unfortunately I have found that the autosave to ‘quit’ file is not perfect, very good, but some complex scenes with multiple scripts enabled or massively high cpu intensive files will not save on quit, so don’t rely on it. Save your work regularly.
m.a.

@ Guy de Vere: I used to be annoyed by this (lack of) feature. As i can judge by the number of posts, you must be rather new to Blender. So let me tell you you will adapt and get used to it as well as to the Ctrl W to save !
After a while, i didnt close accidentaly anymore…
Welcome to the forum by the way !