Close prefs. window before terminating app