Closing detached window should mark devtools as not visible

Otherwise devtools would still be thought as opened when it is closed via clicking the close button.