Make window_before_close_hook a coroutine hook.