close the programm (either by using the main-Menu or the close icon)

The Programm should ask for saving the unsaved/changed dokument and then quit without any error.