modify BeforeShut function in NFCLuaScriptModule