Fix a bug causing the last record of file to be missed in RecordExtraction.