Improve "cannot handle tree kind ..." error message in rewrite_refs
Reset line number when processing a new file