catch when window closes unexpectedly

specifically, if WinChan opens a popup, and the popup doesn't set up
WinChan.onOpen on the other side, then it won't fire a message before
the window closes. We still want to know when the window is closed.

also, cleanup is a little better
Merge pull request #28 from seanmonstar/detect-closes

catch when window closes unexpectedly