John Carter shared the following tip. You leave your computer unattended while it is performing an update or downloading a large file or some other activity that will take a long time. When you come back to the computer, you find that the process hasn’t completed, and you’ve been logged out. You have unset the option to let your computer go to sleep, so why does that happen?
Go to System Preferences -> Security & Privacy -> General and then click the Advanced button. Uncheck the box that logs you out after ‘x’ minutes of inactivity.
Problem solved.