Fix a race condition in error reporting causing highlighted lines to get out of sync