Recently I upgraded a computer from Ubuntu 16.04 to 18.04. Then I found when I closed the lid, the notebook computer would go to sleep. Here is the instructions from here how to disable the auto-sleep feature.
# Install gnome-tweak-tool:
sudo apt install gnome-tweak-tool
# Run gnome-tweaks.
# Change the option under "Power" for "Suspend when laptop lid is closed" to "off".