[RepositoryManager] Fix race condition when persisting
[RepositoryManager] Fix race condition when persisting

There was a small race condition when we persist repository manager
because we read all the handles when saving a handle after lookup.

-- <rdar://problem/32458039> Fix race condition in repository manager persistence

vmanot/swift-package-manager,apple/swift-package-manager,JGiola/swift-package-manager,vmanot/swift-package-manager,sschiau/swift-package-manager,abertelrud/swift-package-manager,JGiola/swift-package-manager,JGiola/swift-package-manager,apple/swift-package-manager,abertelrud/swift-package-manager,sschiau/swift-package-manager,apple/swift-package-manager,sschiau/swift-package-manager,vmanot/swift-package-manager,JGiola/swift-package-manager,abertelrud/swift-package-manager,sschiau/swift-package-manager,apple/swift-package-manager,apple/swift-package-manager,abertelrud/swift-package-manager,vmanot/swift-package-manager,abertelrud/swift-package-manager,vmanot/swift-package-manager,JGiola/swift-package-manager,sschiau/swift-package-manager