Move directory sync code into os_fsync.c, only sync directories when creating files.