Wells Fargo has agreed to pay $575 million to resolve investigations by all 50 states and Washington, D.C., into a range of practices, the latest chapter in the bank’s long-running legal problems.

The deal ends investigations that began after federal regulators revealed in September 2016 that Wells Fargo employees had for years opened millions of unauthorized bank accounts in customers’ names. The employees said they had done so because they feared losing their jobs if they could not meet the bank’s aggressive sales goals.

The agreement comes after New York reached a separate, $65 million settlement with Wells Fargo in October over the sham accounts, and after the bank paid $1 billion in April to settle federal charges related to its handling of mortgages and auto loans.

Wells Fargo admitted what it had done and paid fines of $185 million, but the company’s scandals kept multiplying. The bank was accused of forcing unwanted auto insurance on some customers who took out car loans, enrolling more than 500,000 people in a bill-paying service they might not have sought, overcharging some mortgage customers and charging customers for life-insurance policies they did not purchase.

The bank has gotten some relief from its legal woes over the past year, but its troubles are far from over. In February, the Federal Reserve announced that it would restrict Wells from growing, vowing not to lift the cap until the bank significantly improved its internal checks and balances.

In April, the bank agreed to pay $1 billion to the Consumer Financial Protection Bureau and the Office of the Comptroller of the Currency to settle investigations into its mortgage- and auto-lending practices. On Dec. 19, the bank agreed to pay $480 million to settle a class-action claim from shareholders who said they were harmed by the bank’s false statements about its misdeeds.

Wells Fargo is still trying to fulfill regulators’ requirements before getting a clean bill of health. In October, as scrutiny by the Fed and the Comptroller of the Currency continued, the bank suspended two top executives.