It seems that your file has some characters that are not 'utf-8' and hence 'utf-8' codec cannot decode them.
When you open your input file, you can explicitly mention the encoding. The list of standard encodings supported by Python is here.
Try the following code and if it does not work, you can try other encodings mentioned in the above link.
with open(ifile, 'r', encoding='latin-1') as fi:
for rec in fi: