fix resource leak

When ngx_small_light failed to process a image,
term funtion is not called