Introduce a Truncate() function that works on POSIX and Windows.

Hopefully fixes the build on Windows.