when H1B petition is pending, you go out of US, which does NOT mean you give up your H1B petition, but mean that you give up your change of status (TN->H1 or TN extension). if you (your company) apply a new H1 petition for you and a COS at the same time (this is a very common way), you can work even when your TN expired (between april 1 and oct 1 or whatever the date you get your H1 denial). But, if you leave the country, you automatically terminate your COS application. So, you can only come back and work under TN status.