Tankless Water Heater and turning off main water supply
There are flow sensors in tankless units so if you are simply shutting down the valve on the water supply and then reopening it I wouldn't be too concerned. That being said shutting down the water supply can change the pressure in the system as temperatures of the water change. I don't think it would cause any trouble. But, anytime you close the valve the water is in a closed system. It's a good idea to install a potable water expansion tank.

This is a potable water expansion tank

www.amazon.ca

They are almost exclusively 3/4" NPT. You would need to measure your static pressure(pressure with the taps closed and the main open) with a gauge. Then pump air into the air nipple (bottom of the tank pictured above) with a bicycle pump or preferably air compressor to match the static pressure before installing it. It's a good idea to install a service valve as well.