Routines to handle any cleanup before the instance shuts down.
        Sockets and filehandles should be closed explicitly, to prevent
        leaks.

def close(self):
        '''
        Routines to handle any cleanup before the instance shuts down.
        Sockets and filehandles should be closed explicitly, to prevent
        leaks.
        '''
        if not self._closing:
            IPCClient.close(self)
            if self._closing:
                # This will prevent this message from showing up:
                # '[ERROR   ] Future exception was never retrieved:
                # StreamClosedError'
                if self._read_sync_future is not None and self._read_sync_future.done():
                    self._read_sync_future.exception()
                if self._read_stream_future is not None and self._read_stream_future.done():
                    self._read_stream_future.exception()