mkfinal (TMail::UNIXMbox)

    # File lib/action_mailer/vendor/tmail-1.1.0/tmail/mailbox.rb, line 188
        def UNIXMbox.mkfinal( mh, mboxfile, writeback_p, cleanup_p )
          lambda {
              if writeback_p
                lock(mboxfile) {|f|
                    mh.each_port do |port|
                      f.puts create_from_line(port)
                      port.ropen {|r|
                          f.puts r.read
                      }
                    end
                }
              end
              if cleanup_p
                Dir.foreach(mh.dirname) do |fname|
                  next if /\A\.\.?\z/ === fname
                  File.unlink "#{mh.dirname}/#{fname}"
                end
                Dir.rmdir mh.dirname
              end
          }
        end