added catch incase socket was already closed - this could be done better
0.5.6