Hi, I went through the same thing last year, not being picked felt like a dead end at first. In my case I ended up looking at the O-1 route with my employer, but the evidence bar was higher than I expected, so we also explored a transfer to the Canada office as a backup plan. Have you checked whether your company has offices in Canada or elsewhere? It might open another door while you wait for the next lottery. Good luck, I know how frustrating it is!
If you lose your job on a closed permit, you can stay in Canada until the permit expires, but you can’t work for another employer without a new permit. Look into the open permit for vulnerable workers.
For a student’s spouse, the open work permit is valid for the same length as the study permit. We got it without any issue, just apply in the same application.