Added a synchronous writeSync mehtod