To prevent the laptop from suspending when the lid is closed, set the following in /etc/systemd/logind.conf:

HandleLidSwitch=lock