TikTok owner ByteDance has agreed a deal with investors that will stop the social media app from being banned in the United States.