Apply for a AP before leaving in case you can not get H1B visa. H1B should not affect your pending I-485 (my understanding).