Treasury Wine Estates has agreed to pay around US$40m to settle a shareholder class action lawsuit that dates back to 2014.