Made sure that connections are always closed.
Merge pull request #42 from kaisellgren/master

Better stability