[#598] Handle mismatching file names in error highlighting

Make sure the file name in the stacktrace matches that of the current buffer.