Clear any orphan thumbnail before saving a new one

fix #993