Token stream: resource acquisition with neglected destruction

When max boolean clauses are reached the token stream is left back in an invalid state, as close is not called. Fixing the issue with RAII.