tdb: correct cleanup