If the end of the error exceeds the file, set it to the last line, similarly as it is done with the beginning of the error.