Canada top court upholds migrant pact with the US