When that happens, I simply enter 'iex> end' which would return a SyntaxError, and start over but without having to restart iex.