Your mistake is you are saving all data when client disconnects, when it must be saved a few seconds later a data is changed. Then you can assume is not needed to re-save data on disconnect (and avoid this) and your data would be safe from a random crash, which wont call any data save function from your addon. In summary, refactor your save code, it must get a bit complex to make it work as expected.