IDEX-785: auto close input stream