Macbook unexpectedly shuts down programs when I close the lid OSX 10.14.6, late 2013 13" macbook pro.

I keep a lot of tabs open on my laptop, and lately I've started noticing that I can't find tabs that I thought were open. Turns out that when I close the macbook's lid, it will sometimes close whatever tab or window is active at the time (equivalent to cmd+w, I think). If, for example, it's an unsaved Word document, when I open the laptop again I'll see the "do you want to save your work" dialogue; if I had Chrome or Safari open in the foreground, it'll just close whatever tab was open. 

This doesn't seem to always happen, making it frustratingly difficult to debug. 

Any idea what could cause this behavior?
Interesting. One setting I would check to see if it's enabled is if it's set to log you out after a certain amount of time. You can do this by going to the system preferences, then security &amp; privacy, then click the advanced button on the lower right corner and the option will be shown.