Release the lock as early as possible.