Method has_events raises KeyError if group does not exist. Cellcognition saves an empty group. This case was covered, but if group does not exist at all, the method must also return False.
The result is that the file handle may not get closed properly