On platforms without os.fdatasync (eg. OS-X), use fcntl.F_FULLFSYNC instead