Chmod files on EPERM on win32.

Superseeds gh-24.