perform garbage collection after closing memory databases