Properly reset and close the certificate store

Properly reset and close the cert store.