Further error-handling improvements.
Further error-handling improvements.

Consistently return errors via the callback, to ensure that the application
gets a chance to handle them uniformly.

Ensure that outputDirectory is cleaned up on every error path to avoid
leaking disk space.

Remove the outputDirectory as soon as the output PDF file is opened,
to avoid leaking the outputDirectory if the user doesn't fully read
the file or does a process.exit(0) after closing the PDF file.  This
also allows us to report errors in the rimraf consistently.

gammasoft/latex