Fix the terminate routine to avoid deadlock in ewk_shutdown