title: applescript: how to terminate an executing terminal
body: <p>I'm trying to make an apple script to allow me to manage a cpp project automatically. And I used Jenkins too.</p>
  
  <p>Basically, the cpp project is a kind of infinite loop, which will execute in a terminal. And I set Jenkins rebuild and execute it per 20 sec. In other words, my pc should do the tasks below:<br>
  1) rebuild the project;<br>
  2) execute the project;<br>
  3) wait for 20 sec;<br>
  4) close the terminal.<br></p>
  
  <p>However, when I arrive at 4), a dialog will pop up: Do you want to close this window?<br>
  So I have to click the button "Close".</p>
  
  <p>My question is: how to code in applescript to do the 4) automatically?<br></p>
  
  <p>Here is my applescript:</p>
  
  <pre><code>tell application "Terminal"
      do script "cd /Users/Shared/Jenkins/Home/workspace/test"
      do script "make clean" in window 1
      do script "make" in window 1
      do script "./matrix.out" in window 1
      delay 20
      close window 1  # problem's here
  end tell
  </code></pre>