If part of a system takes an exclusive lock to a resource and then fails without unlocking that resource, is it possible for some other part (which would not have the same session to the resource) to unlock the resource? If not, are you forced to go to such extremes as cycling power to unlock the resource?
Are you using VISA? If you are, you may be able to close the open reference by using viClear. For more information on using this function, see chapter 5 of the NI-VISA Programmer Reference Manual (see link below).