Issue with Hash.LOAD_RESOURCE_FILE

When I restart a resource that has this as its __resource.lua

local vcf_files={
	'SERIFF'
}
local function vcf_loader()

  for i = 1, #vcf_files do
	local car = vcf_files[i]
	files('stream/' .. car .. '/ELS/' .. car .. '.xml')
	ELSFMVCF('stream/' .. car .. '/ELS/' .. car .. '.xml')
  end
end
vcf_loader()

My mod is listening for onClientResourceStart fails to get the files.
When that event fires it then goes and fetches the files from ELSFMVCF.
The line of code that seems to be failing is

var data = Function.Call<string>(Hash.LOAD_RESOURCE_FILE, name, filename);

here is more for refrence

            num = Function.Call<int>(Hash.GET_NUM_RESOURCE_METADATA, name, "ELSFMVCF");
#if DEBUG
            Debug.WriteLine("number of VCF files to load: " + num.ToString() + " " + name);
#endif
            for (int i = 0; i < num; i++)
            {
                var filename = Function.Call<string>(Hash.GET_RESOURCE_METADATA, name, "ELSFMVCF", i);
#if DEBUG
                Debug.WriteLine($"Name: {name}, Loading: {filename}");
#endif


                var data = Function.Call<string>(Hash.LOAD_RESOURCE_FILE, name, filename);
                VCF.load(SettingsType.Type.VCF, filename, data);
            }

This properly works when The resource starts fine when the client first joins but if the mod that has the VCF files is restarted it causes issues.

Directory layout

│   loader.lua
│   __resource.lua
│
└───stream
    └───SHERIFF
        │   sheriff.yft
        │   sheriff.ytd
        │   sheriff_hi.yft
        │
        └───ELS
                SHERIFF.xml

Exception data

[   1373266] queue event onClientResourceStart
[   1373281] Loading mounted data files (total: 1)
[   1373281] open packfile C:/FiveM/standard/FiveM.app/cache/dunno/mods.rpf
[   1373281] Initializing pseudo-pack C:/FiveM/standard/FiveM.app/cache/dunno/mods.rpf
[   1373281] Scanned packfile: 2 entries.
[   1373281] close packfile mods.rpf
[   1373281] done loading resource_surrogate:/mods.rpf in data file mounter class CfxPackfileMounter.
[   1373297] number of INI files to load: 0 mods
[   1373297] number of VCF files to load: 1 mods
[   1373297] Name: mods Loading: stream/SERIFF/ELS/SERIFF.xml
[   1373391] Error invoking callback for event onClientResourceStart: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object

[   1373391]   at CitizenFX.Core.ScriptContext.GetResult (System.Type type, System.Byte[] ptr) [0x00028] in <30ec4c26fbcd44a68adbda4223c19e58>:0 

[   1373391]   at CitizenFX.Core.ScriptContext.GetResult (System.Type type) [0x00000] in <30ec4c26fbcd44a68adbda4223c19e58>:0 

[   1373391]   at CitizenFX.Core.Native.Function.InvokeInternal (CitizenFX.Core.Native.Hash nativeHash, System.Type returnType, CitizenFX.Core.Native.InputArgument[] args) [0x00044] in <30ec4c26fbcd44a68adbda4223c19e58>:0 

[   1373391]   at CitizenFX.Core.Native.Function.Call[T] (CitizenFX.Core.Native.Hash hash, CitizenFX.Core.Native.InputArgument[] arguments) [0x00000] in <30ec4c26fbcd44a68adbda4223c19e58>:0 

[   1373391]   at ELS.FileLoader.RunLoadeer (System.String name) [0x001c7] in <b6899d1a5f68411ea5c5c2ee7b76b6e0>:0 

[   1373391]   at ELS.ELS.<.ctor>b__6_0 (System.String obj) [0x000c8] in <b6899d1a5f68411ea5c5c2ee7b76b6e0>:0 

[   1373391]   at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)

[   1373391]   at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <a4e3abdd630b4c98a9d6f31a99197de6>:0 

[   1373391]    --- End of inner exception stack trace ---

[   1373391]   at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <a4e3abdd630b4c98a9d6f31a99197de6>:0 

[   1373391]   at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <a4e3abdd630b4c98a9d6f31a99197de6>:0 

[   1373391]   at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <a4e3abdd630b4c98a9d6f31a99197de6>:0 

[   1373391]   at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <a4e3abdd630b4c98a9d6f31a99197de6>:0 

[   1373391]   at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <a4e3abdd630b4c98a9d6f31a99197de6>:0 

[   1373391]   at CitizenFX.Core.EventHandlerEntry.Invoke (System.Object[] args) [0x00063] in <30ec4c26fbcd44a68adbda4223c19e58>:0