Fix memory issues in bitvector theory, which is now valgrind-clean (mostly resolves bug #594).