'closes the stream, releasing any system resources associated with it'

def close(self):

    print 'closing    stream    !'
    self.active = False
    self.buf_in.cookie = None
    self.buf_out.cookie = None
