Added option to not close stream afterwards