Fixes cleanup issues and improves cleanup logic.
Fixes py3-related bugs.
Merge branch 'master' into bugfix/cleanup

Conflicts:
	distarray/context.py
Merge branch 'master' into bugfix/cleanup

Conflicts:
	distarray/context.py
Merge pull request #331 from enthought/bugfix/cleanup

Fixes cleanup issues and improves cleanup logic.