Fix REPL bug: Clear state after syntax error