server: Hide a window before destroying it if it was still visible.