Close output stream in downloadFile, fixes #19