Funny, I just had the same issue last night and thought it was the battery since it still had the original in it (2009).

Replaced the battery and on my way to work this morning the check engine...