refactor: check if there was send data on stopping
refactor: check if there was send data on stopping

If not, then do some extra cleanup, including closing the websocket
connection.

itslanguage/itslanguage-js,itslanguage/itslanguage-js