Thomas H. Lee, the private equity company that took control of Refco shortly before it went public, has agreed to pay $145 million to settle all claims by brokerage customers and Refco’s bankruptcy trustee.