macOS weird logout issue There is a weird logout issue on my MacBook Air (13", Early 2015), with macOS Sierra 10.12.4 installed. When I wake up my computer in the morning (it was neither turned off nor hibernated, but simply locked), I found that the system wanted to log out automatically. Since an application wasn't closed (that's Oracle VM VirtualBox, if it helps; an instance of VM was operating) the previous night, I saw a dialog asking whether I would continue to log out (probably in order to let me deal with the unsaved VM state). Also, I saw a file called "logout", 0KB in size, resided in the Downloads folder, which was created in the midnight.

Please help me figure out why this happens. It feels really strange. Thank you.
Check Energy Saver

It may be worth checking your energy saver preferences:


Go to Apple menu > System Preferences
Click on Energy Saver
Click on the Schedule button at bottom right


Now check to see whether your Mac was scheduled to shutdown etc.

Boot into Safe Mode

Follow these steps to boot your MacBook Air into Safe Mode:


Fully shut down your MacBook Air
Restart your MacBook Air
Immediately press the Shift key and keep it down 
Let go of the Shift key when you see the login window (NOTE: If you have FileVault enabled you may need to log in twice).
Leave your MacBook Air in Safe Mode until the next morning
Wake your MacBook Air and see if the issue is still present
Exit Safe Mode by restarting your Mac as normal


Once you've booted into Safe Mode, let me know how you went and we'll go from there.