Hi everyone,
Last update is the program runs now for 80 hours without being froze.
The error was cause by lock-in and being solved by putting *opc? command after reading from buffer of lock-in.
The NI-Spy was really helpful to identify the cause of the problem.
Thank you everyone for replies.
Cheers