Fix race condition caused by concurrent access to global cache

parent #437 
In this case, wouldn't the result need to point to newFile rather than the CacheFile? Essentially, isn't the CacheFile incorrect at this point?