Add Preferences window and save preferences