clockwork: use defer to unlock