added close-tab handling for unsaved changes