title: OnClose or OnExit function in Google App Script
body: <p>I'm trying to get a dynamic list of "Current Viewers" of over 50 Google Spreadsheets in just one master sheet. So far, I've got the code to run that inserts a new row using the onOpen function (just a row that records: user email, viewing document, date of entry, time of entry etc.) and I've also got the code to remove the entry when they exit - I just have no way of firing the code upon exit!</p>
  
  <p>This is why I'm looking for an <code>OnClose()</code> or <code>OnExit()</code> function - just like the <code>onOpen</code> one. Is there any way I can accomplish this?</p>