let close t =
    begin
      close_out t ;
      clean t.files ;
      t.files <- [] ;
      t.logcmd <- None ;
    end