prova a mettere un ; dopo window.close(): credo che il problema stia lì
Secan