Implement flush_to_disk for macos