To set the end of line to lf only:wq
Thread and MP safety changes.  Note that on windows the append mode support is broken in GDAL VSIL and needs to be fixed for these changes to work correctly