Document that a document has to outlive its pages
Because the Page objects handed out by Document objects store a pointer to the document. If the Document object is deleted before a Page object it handed out, that Page object will have a stale pointer.
Thanks to Stefan Löffler from Texworks for pointing this out.