Add lock around write in PrintLogger

Can't find any docs on thread-safety of file.write so better safe than sorry.