Weeks before Stony Brook Medicine’s hospitals and providers were to be removed from UnitedHealthcare’s network following the expiration of a contract, the two parties have come to terms with respect to new agreements for hospital, physician, and ancillary services.