Perhaps you open LOG in a different package from where you print LOG?
In reply to Re: print() on closed filehandle by ambrus in thread print() on closed filehandle by leonardshoh