window: fix potential data race introduced recently.

w.closed should not be accessed outside the main loop, in fact that
is the sole purpose of w.relayExit which should have been used here
instead.
window: go fmt