You may be able to achieve this using dconf-editor.
Install if you do not have it:
sudo apt install dconf-editor
Open dconf-editor and navigate to /org/gnome/settings-daemon/plugins/power, then scroll down to lid-close-suspend-with-external-monitor and flip the switch to On or True:


