Fix failure to destroy the J2KEncoder when an encode fails/is cancelled.