keyring: open/close and lock management