Arduino nano just stops randomly

You may be getting lockups on the i2c bus.

Are there pullups built in to the rtc or lcd module?

If not, and you are relying on the internal pullups of the Nano, would suggest stronger (lowerResistance) external pullups on the sda/scl lines. You could use 4.7K or even 2K. If there's already 4.7 k on the rtc, you can add additional resistance in parallel to have 2K total on the bus.

I would also put a large capacitor across the Vin and Ground terminals of the Arduino.

You might also want to explore using a reset_on_timeout = true setting in the Wire library. However, fixing the root cause is a better solution.

https://www.arduino.cc/reference/en/language/functions/communication/wire/setwiretimeout/