we are assuming knowledge of the implementation of `close(window)` here, in specific that the close will happen in the next tick at the earliest, we should remove this assumption.