def _close(self):
callback = self.__callback<EOL>self.__callback = None<EOL>try:<EOL><INDENT>if callback:<EOL><INDENT>callback(None, InterfaceError('<STR_LIT>'))<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>self.__job_queue = []<EOL>self.__alive = False<EOL>self.__stream.close()<EOL><DEDENT>
close the socket and cleanup