Get the code checked out (autozone or buy a cheap OBD2 code reader) and verify your battery condition and connections. The battery being underhood, right next to a turbo, lots of heat related possibilities exist. Things connected well when cold can expand and fail to connect. Using a digital volt ohm meter (under 30 bucks at home cheapo) the battery should display slightly over 12 volts car not running, when warm and, 13-15 volts, engine running. Anything under 12 volts means the battery has a cell down. Check the conditions of the connections as well. Clean, apply dielectric grease (any electronics store) and verify they can tighten. These are basics for any car displaying the described conditions.