US dockworkers approve 6-year contract, averting a strike