Just did a quick google search on the P1638 code for bmw and came up with throttle temporarily stuck open, which can also be related to the P1639 code. (but hard to know which caused which)
Just for shits and giggles as it fixes many more problems than one would think (even if temporary) I'd have the codes cleared (hopefully for free at autozone) as you don't know which of those codes are current and which ones are old... Then immediately do a battery reset by removing the ground cable from the battery for about 10 minutes. (long enough for internal capacitors to discharge) Then when you hook the battery back up, turn the key on leaving engine off and just let it sit there for a minute so it can go through all of its self checks, including throttle motor.
After letting it sit with the key on for a minute, start her up and hopefully she will drive normally for you. And if/when the problems happen again (if they don't reappear immediately on test drive) you can find a shop with the GT1 diagnostics or bring it in to the dealer for diagnosis of the currently present faults.