If you’re having trouble closing a window using JavaScript, this might help. I’ve had this problem sometimes in Chrome in particular when I open a window, then follow through a bunch of redirects or something. It seems to lose track of the fact that I “control” this window object, so it doesn’t allow me to close it. This fixes that:
window.open('', '_self', ''); window.close();
Basically it reopens the window on itself, then immediately closes itself. Neat. Haven’t had any problems with it not working in other browsers, but I also haven’t super-widely tested it.