Further fixes to chunked uploading

In 3.2 chunked uploads fail. I noticed that the $chunk (line #136)
descriptor is allocated via "w", which is incompatible with reading.
The result was a "successful" upload that left something 0 bytes in
size.

It's important to specify 'b' with any `fopen()` call for Windows
compatibility. Also for OS compatibility, I removed hardcoded slashes
in favor of the `DIRECTORY_SEPARATOR` constant.

Also, when unlinking the parts of a chunked upload we don't want an
open file handle to linger about.
Merge pull request #675 from rk/patch-1

Further fixes to chunked uploading