Fix crash when close connection due to xml error
Fix crash bug because of missing <stream:stream> at beginning