Close stream when done