Fix leaks in parser module

Prevent the parser and parser resources being leaked by callers.
Implement a proper parser.Stop, and make sure all associated goroutines
are wound down when it is called.