macOS weird logout issue
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.