Petraeus quits CIA over affair