Fix auto closing of the preference window when connected