bpo-35379: Check IDLE objects before calling method by srinivasreddy · Pull Request #10564 · python/cpython

If we use this solution, there should be a similar fix for the following.
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/editor.py", line 1021, in _close
if self.io.filename:
AttributeError: 'NoneType' object has no attribute 'filename'

@rhettinger Since I cannot test this, please try the fix both for tracebacks. Problem fixed? Or a different failure?