restore previously working backup if database does not exist and make sure connect/disconnect is only called once

Issue: GCP-9947

Reviewer: Glenn (post-commit)
Merge branch 'restore_database_GCP_9947'