Close GH-844: Ensure that the whole file was downloaded.. Fixes #792, Fixes #824, Fixes #830