destroys connection when some errors occured