close socket on exceptions

Change-Id: I0dee7c109d32e6325845df9ba6e1fbf23a2d1b89
Merge "close socket on exceptions"