Open some popups, closing one should close the others... usually it works, sometimes it doesn't... Seems like beforeunload isn't always called?
Relatedly, beforeunload event listeners will not prevent window close without other prior user interaction (on Win10/Linux & Chrome 86/87)
Test opening the popup and immediately closing it - beforeunload is called, but will not prevent close
Test opening the popup, then (clicking in the popup and then closing the popup, navigating in the popup, or reloading the popup) - beforeunload is called and will prevent close