Fixes cleanup code with new namespace management.
Merge pull request #352 from enthought/bugfix-cleanup

Fixes cleanup code with new namespace management.