The company laid off 40 percent of its workforce in July.

The struggling audio-hosting startup SoundCloud has secured a financial lifeline, with two investors putting up almost $170 million to help the company stay afloat, according to Billboard. As part of the deal, SoundCloud will get a new CEO, the company announced in a press release.

The German company's service is one of the most popular ways to store audio files online, but it has struggled to find a viable business model. As we reported last month, the company was forced to close its San Francisco and London offices and lay off 40 percent of its staff. The company's losses have steadily widened in recent years, reaching €51 million ($60 million) in 2015 and more than $150 million total between 2010 and 2015. Financial results for 2016 aren't publicly available yet.

Until this deal, it looked like SoundCloud could be forced to shut its doors before the end of the year. The new funding will give the company at least a couple more years to figure out how to become a profitable business. The company launched a subscription music service last year, but that didn't generate enough revenue to avoid last month's layoffs.

The company will now be led by CEO Kerry Trainor and Chief Operating Officer Michael Weissman, both of whom held similar roles at Vimeo, a video-sharing site that is a subsidiary of IAC.