'Close I/O established in "open".'

def shutdown(self):

    self.file.close()
    try:
        self.sock.shutdown(socket.SHUT_RDWR)
    except OSError as e:
        if (e.errno != errno.ENOTCONN):
            raise
    finally:
        self.sock.close()
