I have looked at your program, and without really having the hardware to test it on it's gonna be very difficult to debug. However, I'm not sure if it'll fix your problem, but you should be using 'sequence locals' to pass data (VISA resource name and errors) from one sequence frame to the next instead of local variables. At least if you do this you can track your errors and find out which part of the communication isn't working.
Kim