Fix freshName bug

This fixes a bug where `x$1` generated by freshName conflicts with `x$1` generated by the pattern matcher. Instead of trying to keep counts, this simply tracks every freshName allocated ever and refuses to allocate a name more than once.

A while loop is probably less efficient than doing clever math, but I don't think the perf hit is going to cause anyone to notice.