pub fn sync_dir(dir: impl AsRef<Path>) -> Result<()>
Fsync a directory so a rename or create inside it survives a crash.