I just had the same "need" as you - I didn't want my laptop (an HP Probook) to suspend when the lid is closed (primarily, because Fedora doesn't seem to resume correctly on HP Probooks for a few years now).
Anyway, so I wanted it to not suspend when the lid is closed, dug around, found this post, and figured out what worked for me. If you haven't solved yours yet, this may work:
From here, uncomment the line "HandleLidSwitch=suspend", then change "suspend" to "lock".
I also uncommented the line "LidSwitchIgnoreInhibited=yes", but I don't think it's actually necessary because that is already the default behavior.
It worked as expected on my next boot (didn't try it right after, but I don't suppose it won't work). It doesn't suspend, screen just locks and blanks.