Fix cascading failure when opening graphs

* Lexer state needs to be flushed on failure to open.
Merge pull request #4 from pixelglow/fix-cascading-fail-on-opening-graph

Fix cascading failure when opening graphs