The firm made the agreement with the US Justice Department over two accidents that killed 346 people in 2018 and 2019.