Fixed bug where JavaScript API wouldn't be initialized if file download
failed.