Added close feature

I added a final line of code to close the document.  Do you want any help figuring out how to remove extra characters at some point?