Fix error message and return code on failed downloads

Closes #1700; thanks for reporting !
Merge pull request #1722 from OCamlPro/fix-dl-failure

Fix error message and return code on failed downloads