Free images before going to next page.

This fixes an issue where all image data was leaked when moving
forward/backward in the user interface.