Make sure to closing all file streams

This is awkward, but fos changes with every loop. So I close it in the loop, and the finally is a "just in case" for the last reference that was seen.