How did you fix this? I got the same error but I handle my open and closing files perfectly. Only open if it exists and only close if it exists