Fix image close file handler issue.