- use index-based iterating in LDDocument::closeUnused because deleting documents while iterating over g_loadedFiles causes the iterator to become invalidated