Fix 'cabal clean' on Windows for 'build-type: Custom'.

Fixes #1863.
Revert 97c6a72984931f4ccf628736024d3459a033af6c.

That commit prevented 'sdist' from printing distribution quality warnings.
'writeFileAtomic': use default permissions.

Fixes #2078.