File writing for dor using python primitives and changed dir for temp files from home to execution dir for Win-compatability