Moved image unloading into the image loader thread, using the GC pattern

Actually, not exactly a GC. We maintain a list of loaded images and walk it
to check if one of them can/should be unloaded.