The method window.close() will attempt to close the window in which the script is executing. This is only possible without a user confirmation dialog if the script has the UniversalBrowserWrite privilege. The statement self.close() is effectively window.close() and will also attempt to close the window in which the script is executing.
Do not confuse this method with the document.close() method. They are not the same.
Do not call this for Window objects that represent frames, you cannot close a single frame within a window.