Actually I encountered this issue several times before. Finally I found how to reproduce this error.
The bug re-producing steps on Elementary OS Loki:
1. Open NoMachine application.
2. The app should be opened normal window size. Then grab the from its title bar and hit the top of the screen by dragging for to maximize the app window.
3. Click onto a found NoMachine server to connect it and voila! My session is closed. After logging-in I would see that the all opened application was closed. The all of my works..
Fortunately I could find the bug reproducing. After this I ever and never try to maximize and then connect to my desktop computer.
I’ve added the syslog lines as an attachment.
To get relevant log lines, first I’ve opened and maximized the app window by dragging and hitting then cleared the syslog file and then click onto the my founded NoMachine server-that is my linux desktop.
After I was thrown, I waited 10 second without a touch to my laptop to find the relevant part of syslog thanks to log writing time.
I hope this helps.