Ensure stream port always closed on dispose
Fixed flatten GC bug