manually cleaning up lexer to avoid memory leaks