[Review Only] Terminate tern worker on quit

This fixes issue #7683.