disconnect and close stream