Preferences are saved when closing PreferenceDialog