Do not close string and character literals before text

Fixes #1001652