before print close the stream