must close tdb connection after processing all documents