Rewrite of the IDE's project closing system, motivated by issue #277

This _should_ fix the problems addressed in that issue. A yes/no/cancel dialog pops up when you try to close a project with changes now, asking if you want to save all or not.