Judge partially terminates agreement governing conditions for migrant children in US custody