Best relieving date for H1B w/ COS

Hi

I work for company A on L1 visa. In April, I got a job with Company B. Company B filed my H1B w/ COS and my H1B was approved with a joining date of Oct 1st.

The attorney at company B has adviced that I should stay on in company A till a date that is very close to Oct 1st… if possilble till Sept 28 which is the last working day in Sept.

I am planning to resign around Sept 17 giving 2 weeks of notice. I however fear that company A may relieve me a few days before Sept 28. Related to this I have a couple of questions:

  1. Let’s say if I am released from Company A on Sept 20, will this hamper my H1B?

  2. What is the earliest I can be relieved from Company A without having any impact on my new H1B?

Look forward to your response.

Thanks