Use sync method if hflush is not available.