If you H1-B won't be approved before you change to the 2nd company, your application may be revoked and you need to reapply...........I'm not sure if you need to pay for all the applications fees, which will depend on your sponsor...
The best way is to ask the attorney, who knows the exact process...........