Fixes runtime error of close function.
Merge pull request #3 from y-matsuwitter/master

Fixes runtime error on close()