This is a correction of my previous answer:
newwindow=window.open();
newdocument=newwindow.document;
newdocument.write("Hello World.<input type='button' value='close' onclick='window.close()' />");
newdocument.close();
as you can see, window.close() works ok.
For a specific example, you can use this -> create 2 files:
1. windowOpener.html
<html>
<body>
<input type="button" value="open" onclick="window.open('newWindow.html')" />
</body>
</html>
2. newWindow.html
<html>
<body>
<input type="button" value="close" onclick="window.close()" />
</body>
</html>
if you'll run windowOpener.html and click 'open' it will open 'newWindow.html'. clicking 'close' in the new opened window, will close it. voila.