Dispose images properly

Thanks to @secondsabre for reporting this bug.