Fix memory leak of RewriterVars when the rewrite doesn't commit

I'm not sure I like the current approach, but it seems to be working.