Write filename in case of error. Excet KeyErrors.