When you try to close a hidden ToolWindow in ActiveWindowChanged, you are prevented from docking ToolWindows which are in AutoHide mode.