If the computer automatically sleeps, the connection will be lost. In the macOS settings under Energy Saver, do the following in order to keep the computer from “sleeping” and thus turning off the VPN: