Added support to delete temporary files on-exit.

The standard Java File.deleteOnExit() method is unpredictable, e.g. on
some operating systems it will not delete directories that are not
empty.