'stop capturing, restore streams, return original capture file,
seeked to position zero.'

def done(self):

    targetfd_save = self.__dict__.pop('targetfd_save')
    os.dup2(targetfd_save, self.targetfd)
    os.close(targetfd_save)
    self.syscapture.done()
    self.tmpfile.close()
