Oh calling window.close seems really weird as we are still using the hidden window.
We haven't had any report of anything being broken because of that, it may just be ignore, but it could be worth also removing it.