implemented warn before leave when there a unsaved contents