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

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