Open output file in binary mode in download()

This fixes #553.
Merge pull request #564 from sryze/patch-1

Open output file in binary mode in download()