Added example with sync writing to file