Not quite. The approved H1B does not become invalid. When you (actually your employer) apply for an H1 while on H4, then two things are happening: (1) the employer is requesting permission to hire you and (2) a change of status is being requested from H4 to H1. If you go through premium processing and get it approved, then the former takes effect from June or July when the residency starts, and the later also takes effect at the same time. If you remained in the US and never travelled, then automatically you change to H1B in June/July.
Travelling out of the country never invalidates item (1). Only thing is that you will remain on H4 in March when you re-enter. Then subsequently you can travel out of the country in May or June, use the same H1B approval notice that you receive now, get an H1B visa stamped, and then re-enter on H1B. This can be done in Canada or Mexico, although generally it is better to do in the home country, since your medical degree is not from the US.
Note that if you are entering on H1B, you cannot enter the US ten days earlier to the start date on the H1B petition.
Not legal advice. Check with an attorney.