cleanup()'s primary purpose is to do that: cleanup(). The first reason it was included was to be able to undef global variables set up in setup(). It may also be used to make database commits, or for any other reason.