I-485 pending status is legal,but if your I-485 case is dineid,you will become illegal at once & can't go back to H1B.