Fixing resource leak
Merge pull request #164 from lev-kuznetsov/master

Fixing resource leak