dbtoyaml: fix RuntimeError when using -n option

RuntimeError: dictionary changed size during iteration
Signed-off-by: Philippe Pepiot <phil@philpep.org>