Fixed bug that could cause connection to close prematurely.

Fixed an segmentation fault in case of exiting XBMC.

Corrected version number
Merge pull request #319 from sub3/gotham

Fixed bug that could cause connection to close prematurely (gotham backport)