Fixes bug where errors could be unfenced resulting in hidden remaining content e.g. https://github.com/astral-sh/ruff/pull/8508#issuecomment-1794960132
Fixes bug where errors could be unfenced resulting in hidden remaining content e.g. https://github.com/astral-sh/ruff/pull/8508#issuecomment-1794960132