cleanup in case of a parser error

Signed-off-by: Janos Laube <janos.dev@gmail.com>