Fixed incomplete shutting down in Python 2.7. There remains a circular reference or something blocking proper clean up in Python 3.4.