Defer jpeg/swscale context object cleanup

This ought to make sure they're freed on error/panic.