json writer cleanup