Added guard to prevent against closing an unsaved file.