fixed the preference window closing whole program