US court: Trump can end temporary legal status for 4 nations