A court has ruled the UK does not need to pay Rwanda after the UK pulled a deal between the two countries.