doc:Free()
Note that after calling doc:Free() you must no longer use any handles belonging to this document, e.g. page handles, font handles, and of course the document handle itself.