Error accessing sage100: "The file SO SalesOrderHeaderis being used by another task and cannot be opened"

SOLVED

Hi,

I have some code that imports an invoice into SAGE100 using BOI, it does work fine in my development environment (Sage100 2014) but when I try it in the client's machine (Sage100 2013) it does fails with the error " The file SO SalesOrderHeader is being used by another task and cannot be opened."  when trying to get a reference to the SO_Invoice_bus object

There is no body logged into the system and the same thing happen when I try to access another module like the CashReceiptsHeader.

Can someboyd help me out with this?

Thank for you help,

Ignacio

This is the code, the error happen in the last highlighted line 

using (DispatchObject pvx = new DispatchObject("ProvideX.Script"))
{
// Replace the text "*PATH TO MAS90\HOME*" with the correct MAS90\Home path in the line below
pvx.InvokeMethod("Init", mas90);

using (DispatchObject oSS = new DispatchObject(pvx.InvokeMethod("NewObject", "SY_Session")))
{
oSS.InvokeMethod("nSetUser", new object[] { username, password });
oSS.InvokeMethod("nSetCompany", new object[] { companyCode });
string date = DateTime.Today.ToString("yyyyMMdd");
oSS.InvokeMethod("nSetDate", "S/O", date);
oSS.InvokeMethod("nSetModule", "S/O");

int TaskID = (int)oSS.InvokeMethod("nLookupTask", "SO_Invoice_ui");
oSS.InvokeMethod("nSetProgram", TaskID);
using (DispatchObject sales_order = new DispatchObject(pvx.InvokeMethod("NewObject", "SO_Invoice_bus", oSS.GetObject())))