TikTok has avoided a U.S. ban after finalizing a sale to American investors including Oracle, Silver Lake and MGX.