Duchy of Courland, Semigallia and Pilten