finished support for preventing closing app without saving unless explicitly
requested.