Add tracking of unsaved changes and warning on exit in case they are present.