I have used two solutions in the past.
1) Have a main form that opens when the database starts(ie Switchboard). On this form have a button which has the action Application.Quit to quit access. Then on the form's OnClose event run your code to clean-up.
2) The other comes from MS KB article # 210297 - Detect User Idle Time or Inactivity in Access 2000. This event opens a hidden form that runs in the background. In this case it checks to see if the user has been inactive and closes the db after a threshold has been reached.
You could modify and add in your table cleanup code before the database is closed. Also, you could again implement the Onclose Event to clean-up.
I like this approach as you will get the added benefit of having users out of the db when they aren't using it. In addition, the form is hidden so you won't have users messing with it.
HTH,
CT