tern: fix release_writelock call
(cherry picked from commit 493b5ec8a2e10eb79b37afc9fb3f43a3de518211)