Mac: If you need to keep your computer awake until certain apps or processes are finished running and you don’t trust the built-in energy management settings, you can use the boldly named Amphetamine 3.0 to keep your Mac on under whatever circumstances you require.
Amphetamine lives in your menu bar and overrides the energy saving settings of OS X to keep your Mac awake when it might otherwise go to sleep. You can schedule times to activate or deactivate, tell it which displays or drives to keep awake and other triggers to dial down the specific conditions of when you want your computer to stay on. You can even activate it when you connect to a specific Wi-Fi network.
There’s an older app called Caffeine that serves a similar function, but Amphetamine allows for much more control over the exact circumstances of when you want your Mac to stay awake. And it’s free, so it’s a handy tool to have in your menu bar.