US pharmacy chains settle opioid lawsuits for $13bn