def done(self):
targetfd_save = self.__dict__.pop("<STR_LIT>")<EOL>os.dup2(targetfd_save, self.targetfd)<EOL>os.close(targetfd_save)<EOL>self.syscapture.done()<EOL>_attempt_to_close_capture_file(self.tmpfile)<EOL>
stop capturing, restore streams, return original capture file,
        seeked to position zero.