This trick will close the terminal automatically for you after a period of time after being inactive.
We open the file /etc/profile with any editor you like (as root), I prefer Gedit :
sudo gedit /etc/profile
Once the file is opened, append the following lines to the end of the file :
TMOUT=seconds
export TMOUT
Replace seconds by any number of seconds you want. Save the file and execute this following command to apply the new changes :
source /etc/profile
In my example I used 600, so my Terminal will be automatically closed after 600 seconds of inactivity.