Added dialog box to prevent close on unsaved changes.