To avoid any sort of a race condition, I would prefer if we waited for the `onclose` event before continuing with the rest of the test.