fix race condition in profiledir creation.
Merge pull request #4748 from porterjamesj/race-fix

fix race condition in profiledir creation.