winchan detects if window gets closed

if the dialog is redirected to an IdP to do auth, and the user dismisses
the dialog then, this will let winchan detect that the dialog has been
closed. it will trigger oncancel.

fixes #1773
Merge pull request #3325 from seanmonstar/1773-winchan_closes

WinChan detects if window gets closed