DetachPane() was not removing all references to the window if the window...

...'s pane was inside a notebook, leading to a crash on the next Update().