fix race conditions when creating folders for generated code