Added error handling when downloading and saving images.