Make JPEG context initialization and destruction more robust & flexible.

 * Initializers now destroy the previous context, prior to allocating a fresh one.
 * Destructors now take pointers to a context pointer and zero it on exit.
 * Destructors now gracefully exit when passed pointers to a null context pointer.
 * The decompression function also takes a pointer to a context pointer, because it may reset it on errors.
 * The compression functions also take pointers to a context pointer, for symmetry.