Fixed images dialog not closing and links problem with database