Prevent event bubbling in preferences dialog

Prevents events from bubbling up when you save or close the preferences dialog