Handling closed connection