Can I quit while my H1B is being processed?

The expiration of my h1b was in Oct. I got laid off from my job in Sept. I got a new job and applied for my renewal and transfer to new employer within a week - only used 7 days out of the 60 day grace period. I have the receipt (i797c) but have not received the approved h1b yet. If I quit my job when the application is being processed, how long do I have to leave the USA? I am planning to move to my home country.

Your employer will withdraw your H1B petition once you leave, so legally you still have up to 60 days or leave as soon as practically possible.