added WarningMsg for unsaved changes when leaving