End streams correctly