Stabilizes wating when closing Preferences Dialog. Fixes: #867