you can remain in the us while h1b is pending. i was in the same boat--my opt ran out but it was still a couple of months away from the start time in my new AP position. so i just waited in the us while the university handles my h1b visa. just make sure that you have cobra or some other kind of health insurance in place.