add error handling to socket sends to cleanup connections in case of error