Iran temporarily closed most of its airspace late Wednesday, forcing airlines to reroute flights as tensions with the United States escalated.