The three countries have finalised a trade deal that will replace the 26-year-old North American Free Trade Agreement.