How do I close a window and why does it not work on the first one?
Use windowRef.close(), where windowRef is a window object reference,
such as window, top, parent, self, or a reference obtained from
the window.open() method. You can only close windows opened by
scripts, no others.