SERVER-5809 SERVER-5697 Improve quote handling in the shell

When skipping quoted strings in isBalanced(), skip past quotes
escaped with backslash.  Do not enter multi-line mode when a
line ends with an unterminated string.  Add startup test cases
for issues raised by these tickets.