Fixed toolwindow handling in some circumstances