State Farm Mutual Automobile Insurance Co., the largest U.S. home and auto insurer, plans to shut 11 U.S. facilities, displacing about 4,200 workers, after a $7 billion annual underwriting loss last year on auto policies.

The insurer will exit Parsippany, New Jersey, and Petaluma, California, in 2018 and the other locations by 2021, the Bloomington, Illinois-based company said Thursday in a statement on its website. The work will move to the headquarters and offices in cities including Atlanta, Dallas and Phoenix. The company said employees in affected facilities will have opportunities at other State Farm locations.

State Farm, Allstate Corp., Hartford Financial Services Group Inc. and Warren Buffett’s Berkshire Hathaway Inc. are among companies that have been burned in recent years by higher claims expenses from car crashes as more drivers are distracted by electronic devices. Higher repair costs have also hurt in an era when drivers are logging more miles behind the wheel. Companies have been charging more for coverage and looking for ways to reduce costs.

“The company’s decision to exit these facilities was based on efforts to best serve customers by gaining efficiency through streamlining and improving processes, leveraging technology, and concentrating employees in larger locations,” State Farm said in the statement.

Chief Executive Officer Michael Tipsord is working to improve results at the insurer after being named in 2015 to replace Ed Rust, who led the policyholder-owned company for three decades. Net income dropped to $400 million last year from $6.2 billion in 2015, hurt by the auto insurance results. The company posted better returns on businesses including residential coverage, banking and mutual funds. State Farm has almost 70,000 employees.

Michigan, Indiana

The locations targeted for closure in 2019 are Kalamazoo, Michigan; Irvine, California; and Tulsa, Oklahoma. Six other facilities will be shut in the next two years: Medley, Florida; Indianapolis; Downers Grove, Illinois; West Lafayette, Indiana; Bakersfield, California; and Frederick, Maryland. Justin Tomczak, a spokesman for State Farm, said the company is exiting leased facilities.

There are more than 500 employees in the Kalamazoo, Tulsa, Bakersfield and Frederick facilities, he said. The first two offices to shut, Parsippany and Petaluma, have fewer than 60.

State Farm in 2013 struck a deal to sell many of its offices to Lone Star Funds and then lease back the property. The insurer said at the time that the transactions would provide cash and give the company more flexibility.

“We have already seen many benefits to housing large groups of employees together in the hubs,” Tomczak said by email.