@sebastian-roth
Thanks to the suggestion, the tcpdump software helped me to understand that the host did not send any data packet to the FOG server during the closing phase of the snap-in. All this was due to the fact that my script assigns a static IP to the Host when certain parameters occur, so, in the IP assignment phase, the Host was offline and the snap-in was unable to communicate with the FOG server. So I solved the problem by inserting a 10-second pause in the script with the powershell start-sleep command, allowing the Host to return online before closing the snap-in.
I wanted to thank you for your availability and tell you that you are doing a great job with FOG.