I am trying to change lid close behavior using this
When I get to the systemctl restart, system freezes and gets stuck.
What am I doing wrong here?
Is there a simpler solution?
Restarting systemd-logind is not good for your graphical session(s). I would have expected the session to crash and log you out instead, but that's not what they imply either. I have no idea what they were doing. I would suggest rebooting instead of running the restart command.
In case you set it to hibernate, make sure that you have also tested hibernation, e.g.
systemctl hibernate command :).