Because there is a period of time between checking a directory needs creating and creating it, the leads to errors where directories are attempting to be created twice. Add locking on a per directory basis to fix while doing mkdir.