Don't call image.close() (method doesn't exist)