Your IAC (idle air control) may have caused your ERG code.
If you still get a P401 ERG code afterwards then chances are your DPFE is bad, or the hose came off of it....
I had the P401 and it turned out to be the DPFE.
What's funny is there was no mil for the DPFE, but when tested it was out of spec.