Retailer resolves case with US justice department over allegations it fuelled the nation’s opioid crisis