I found a workaround here, thanks to Unrealist.
In the file /etc/acpi/lid.sh comment out this line . /usr/share/acpi-support/screenblank something like this:
sudo pluma /etc/acpi/lid.sh
if [ $? = 0 ]
then
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
#. /usr/share/acpi-support/screenblank
fi
done