daemon: make sure the unlock loop is actually closed

There is a very small race that needs to be closed by ensuring the unlock loop fully exits before entering the lock loop. Needs a waitgroup or done channel.