registry: close regdb in error path (and use it) in init_registry().