PFS-818 #comment better I/O handling to prevent hidden memory leak