Move the strip test out of the loop.
Close the file when we are done.