This happens because of race conditions with websocket state. [ws_frame.c:816](https://github.com/kamailio/kamailio/blob/ac4c2d4579f121395876de2cc6f7649f3c...) - setting socked state `WS_S_CLOSING` [ws_conn.c:703](https://github.com/kamailio/kamailio/blob/master/src/modules/websocket/ws_co...) - setting socket state `WS_S_REMOVING` and updates `rmticks` value.
I will create a pull request to break race conditions.