Add the ability to detect if there are unsaved changes and warn the user before exiting.