Abandoning a """ block left the REPL in multiline mode, so the next
line was swallowed or saved as the system message. Reset the multiline
state along with the buffer whenever readline returns an error.
Fixes#19340
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>