fn sync_dir(dir: &Path) -> Result<()>
Flush the directory entry itself, so the rename survives a power cut and not just a process crash.