You will be terminated from the old company that is closing. You will apply for the new company that is opening, the one that has bought out the old one. If they make you go through a complete screening process, including background check, new application, drug test, etc., this does not change the fact that your old company closed and you are out of work through no fault of your own.
As soon as your last day of work, the 16th, has passed, go on line and file a claim for unemployment benefits. This costs nothing and has no downside. Your reason for leaving the last job will be that the company sold out and closed, effective August 16th. You will probably be given paperwork that verifies this. sure, perhaps the new owners have said they will hire everyone they feel qualifies for their jobs, but that doesn't determine whether or not you get unemployment. If you go straight to work for them without being out of work, you won't need to certify for any weeks of unemployment, and the claim will never be activated. No big loss.
But regardless, the company where you have been employed has closed. This is not your fault. The two companies will not interact, the new company cannot keep you from drawing unemployment benefits from the old company's closure if they elect not to hire you, whatever the reason. They'd like to, as it will affect their experience rating, will probably end up costing them money, but if it happens, it will happen. And your chances of being approved for unemployment benefits if you have no job to go to and your company closes down are pretty good.
The idea isn't to punish you if there is some reason that another company does not wish to hire you. So what if you fail your drug test, or if there were to be something in your background check that doesn't get by this new company's screening process, even though it did for your former employer? That doesn't mean you aren't entitled to unemployment benefits.
A word to the wise, start working on getting your drug screen clear of marijuana. While drawing unemployment, you'll be looking for other jobs, will doubtless have to be tested for most of them. This super thin unlikely story about being around others who are smoking and that causing your THC levels to be too high though you don't use drugs yourself...it won't fly. You need to get some new friends, especially while you are seeking employment.