close sockets even if error was occurred