Skip session removal on IOError.
Add break, change output target.
Fix PEP8 error.
Merge pull request #2644 from bpindelski/rebased/develop/9331_filehandles

Avoid file handle exhaustion during sessions listing (see #9331). (rebased onto develop)