You lost H1b in the last payroll day. By law, you must go back to your country or change your status within same day. The gap is 0. But sometime few weeks is OK. It is maybe.
2. 如果申请了h4,是不是transfer h1b就没问题了呢,还需要去境外激活新的h1b?
From H4 to H1B is not transfer, it is apply a new H1B.
Are you the dependent of LD's 485 ? If not, add it.