Moving self.done to inside close method as suggested by @dirk-thomas