Don't register lock cleanup if WriteLock() failed.

This way we avoid spurious error messages on exit, from when trying to
clear the inexistent lock (minor annoyance seen in the past while
stress-killing cf-serverd).