/* Calls 'luaF_close' in protected mode. Return the original status or, in case of errors, the new status.  */
int luaD_closeprotected(lua_State *L, ptrdiff_t level, int status)
/* Calls 'luaF_close' in protected mode. Return the original status or, in case of errors, the new status.  */
int luaD_closeprotected(lua_State *L, ptrdiff_t level, int status)
{
    struct CloseP pcl;
    pcl.level = restorestack(L, level); pcl.status = status;
    status = luaD_rawrunprotected(L, &closepaux, &pcl);
    if (l_likely(status == LUA_OK))
      return pcl.status;
    else {
      L->ci = old_ci;
      L->allowhook = old_allowhooks;
    }
  }
}