win: Fix window frame on detached window.
Fix crash when closing docked devtools by clicking close button.

We need to send ack for the close message, so we should destroy web contents
after the beforeunload event has fired.