close preferences window after saving token