The deal closes a long-running drama in which U.S. authorities have sought to compel ByteDance to divest.