This article-cum-tip will help you to understand how to close the terminal automatically when there is no activity for a certain number of seconds. This is very simple, just follow the steps mentioned below:
Step 1: Start Terminal and open the file /etc/profile with your favorite text editor.
sudo gedit /etc/profile
Step 2: At the end of the file, just add a couple of lines given below:
Don't forget to specify the timeout by replacing the text in above lines with a specific number.
TMOUT=[MENTION-TIME-IN-SECONDS] export TMOUT
Step 3: Execute the following command for the changes to take place.
And you're done!
sudo source /etc/profile