Fix memory leak in Host.
Fix crash when the window is closed before the settings dialog.