The atomicRename function calls dir.Sync() on a directory handle,
which is not supported on Windows and returns "Access is denied".
This caused truncateTail and resetTo to fail after already closing
the index file, leaving it in a closed state for subsequent reads.
Extract the directory sync into a platform-specific syncDir()
function: a no-op on Windows, and the existing fsync-with-EINVAL-
handling on Unix. This follows the same pattern already used in
triedb/pathdb/fileutils_{unix,windows}.go.
Fixes#34114