Closing resources correctly.
Merge pull request #13 from dimaki/master

Closing resources correctly.