The Document.close() method finishes writing to a document, opened with Document.open().
Document.close()
MDN Reference