Unlock regeneration earlier

When busting cache with versions, a lock is set, but if the request does not contain any output (like a HEAD request or a redirect) the lock is never removed, and so the expired page version is always served.