LCD turns off automatically after sometime

Dear Altruists,
Attached is the sketch and the sketch is about the Arduino MQTT client publish.
I see whenever the 'Send msg' value reaches at some point between 790 to 810, the LCD turns off, even though the RX section of the Arduino keeps blinking.
In Serial mode also, I can see that everything is just fine.
My Arduino is Mega 2560 and I am a complete beginner to this Arduino world.
Can you please help me by giving any of your valuable tips?

Arduino_MQTT_Client_Publish.ino (9.79 KB)

More members will see your code if you post your code as described in the forum guidelines.

Also some details on power supply wouldn't go astray. What is happening implies that your code is actually kosher. So what changes? and why not always the same? It could be a battery...