This post show multiple methods on how you can set computer behaviour when closing laptop lid.
This methods was successfully tested on Kali Linux 2 x86 GNOME installed on a USB thumb drive.

1st Option: Check power setting and Gnome-Tweak-Tool. If there is no option about laptop-lid-action then move to 2nd Option otherwise just adjust the settings as required.

2nd Option: Run dconf-editor then go "org->gnome->settings-daemon->plugins->power". Here you should have the possibility to set various options(buttons actions,sleep,etc.). Among them you should have the 'lid-close-battery-action' and 'lid-close-ac-action settings'. If not move to 3 Option otherwise adjust the settings as required.

3rd Option: Manually edit logind.conf (must be root)
Code:
nano /etc/systemd/logind.conf
Example of content of logind.conf
Code:
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# See logind.conf(5) for details

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
Just uncomment the "HandleLidSwitch=suspend" and change 'suspend' to the most appropriate option (ignore,halt,poweroff,kexec,hibernate,reboot,lock).

Ex. /etc/systemd/logind.conf:
Code:
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# See logind.conf(5) for details

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=kexec #Will keep computer running as the lid was not closed
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
Now just restart logind
Code:
systemctl restart systemd-logind
or reboot your system.
Done. Now everything should work as expected.

Hope it helps. For any suggestion please ask. Thanks
rb4sh