I agree we need a proper function to wait for the window to be closed. At the same time, it's tricky because it's not necessarily a race condition problem coming from the lack of an async API (the reason why selenium waits the way it waits). Here it's an arbitrary timeout used for the ignore feature. I think we effectively want to wait for 3 seconds.