Destroy old window when switching mode