Save settings when leaving the settings view