Try to grab the test data before opening output file.

This keeps from creating empty files when given a bad URL.