Apple - Ignore "prevent sleep" request from a specific app
Your MacBook should always sleep when the lid is closed. If your Mac is not sleeping with the lid closed, this suggests a problem.
There are exceptions:
Some MacBooks can be plugged into external displays and, once connected, the MacBook's lid can be safely closed without triggering system wide sleep.
Previously it has been possible to install a third party kernel extension to override macOS's behaviour and stop sleep with the lid closed. Doing this carries risk and should be avoided.
Blocking Sleep
It is difficult for user space processes to block sleep. Sleep assertions should never block a user initiated sleep, either via closing the lid or requesting sleep from the Finder. Use pmset
to view current power assertions:
pmset -g assertions