Fix 'lock' command failing to lock vault

The CLI exited after calling KeyAgent.forgetKeys() without waiting
for the operation to complete.

Make the fake key agent used in the CLI tests async to expose
this and fix the CLI implementation to wait for the forgetKeys()
operation to complete before returning.