Restore wallet automatic relocking functionality & fix test for same