Making sure to close open files and outputting progress message during scraping