XXX: defrag: cleanup base after removal

This is rather dangerous to do on the fly
stats: proper cleanups and various fixes

This fixes double counting of 'records total' and counts removed entries
in opened base.