if I-485 pending (aos) is your ONLY legal status in US at the time of I140 denial, you need to leave US.