Improving python 2.x compatibility

This seems to be leaking memory in python 2.x whenever you do a connect/close. I believe that this fixes the problem.