Fix transport is undefined(TypeError: Cannot call method onClose of null)