added connection close
Merge pull request #266 from Lerogero/master

added connection close