I ended up getting it to work, for some reason for every store except "CertificateAuthority" you can pass the name as done in my original code (stores[x]). For "CertificateAuthority" I had to explicitly pass "Store.CertificateAuthority".
string[] stores = new string[] { "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", "TrustedPublisher" };
X509Store store = new X509Store(stores[x],StoreLocation.LocalMachine);
X509Store store2= new X509Store(StoreName.CertificateAuthority, StoreLocation.LocalMachine);