Improve error handling when scraping messages

Thanks to @thomasballinger from Hacker School for the input!
Write progress so far to output file when debugging

Thanks to @thomasballinger from Hacker School for the input!