The drugstore chain faces thousands of lawsuits over opioid crisis and struggled for years with failed mergers.