Close file handle on failed record read.

Closes #302.