You can use the freely available app "Amphetamine" from the Mac App Store to keep the Mac awake:
https://apps.apple.com/us/app/amphetamine/id937984704?mt=12
Another similarly free app is "Jiggler":
http://www.sticksoftware.com/software/Jiggler.html