Fix bug with generateTraceSettings leaking DB iterator.