The decision was a win for the Trump administration, which immediately moved to close the program to new applicants, as it had sought with an earlier deadline.