Fix bug #39 click Apply/ok in prefs shows destroyed windows