[TS class] Implement write_data + bugfixes

We need a method to call to write JSON data to disk. This is implemented
here.
Fix a few bugs also:
 - jsons should go in _data
 - _data should be created if not exists
 - we should store the data dir for easy access as self.data_dir
 - Always set the version via create
[TS class] reimplement write_metadata

More checks, also make manifest in data dict