Karl Theodor, Duke in Bavaria