Fix unit test shutdown exception in Python 2.6.