use the with statement here

with open(mrk_fname, 'r') as fid: