Fix problems with pedantic mode complaining about fsync

(which is POSIX-only)