Detect unsaved changes and alert user when he tries to leave without saving these changes