Fixed runtime panic.

Can't close a file we didn't open.