[WS] publish close event after clearing the state