fixes #505 Only take the DBWrite lock when getOrCreateProfileCollection
throws RetryWithWriteLock
Merge branch 'bugs/505'