Fixed xout streams not being closed