Walmart settled claims that it filled thousands of invalid prescriptions at its pharmacies at the height of the opioid epidemic.