fix some issues with resource management
Merge branch 'master' of github.com:kylekinkade/pithos