fix($interpolate): use the first end symbol that forms a valid expression

When an interpolation string has multiple end symbol choices, pick the
occurrence that forms a valid expression

Closes #8642