free allocated images as early as possible

When doing vertical+horizontal assembling, there was an
important buildup of allocated image bytes that was not freed until
the current request was over. The current patch frees temporary
images as sson as we are over with them.