Sort out deallocation of TRI_document_collection_t and TRI_collection_t.