Add method to register function to call when download is complete
This MR moves closing the file handle for downloading to a destination on disk to a new register function which allows the caller to specify a function that will be called once the download is done. This simplifies quite a few parts of the codebase.
Edited by Christopher Schinnerl