close the stream afterwards