sendEvent close code improved

sendEvent needs to send the close code every time or the TCPEvents(+eg?)
stops working