Added error handler when connection is closed abruptly