Fix REPL crashing on execution error

See #2716 and the commit log for more info. The issue seems to have been introduced in be9707f8, during the final refactoring of the REPL code, when a statement was (inadvertently?) moved out from under a try/catch clause.

This also fixes a strange behavior where a blank line in the REPL triggered an error, yet still passed the "empty command evaluates to undefined" test because erroring statements that didn't crash the REPL still happened to return `undefined`.