Fix memory leak.

Bad array bounds while freeing images; next to no memory leaked now (only 28B at closed, and that's constant).