Error handling if socket is closed.