fixing http post error, was not properly closing connection
updating error handling
Merge pull request #233 from georgelm/master

fixing http post error, was not properly closing connection