U.S. Immigration and Customs Enforcement is terminating the contractor running its largest detention facility and putting in charge another firm tasked with improving medical care and other services.