Implement speed optmization inside the dtw_write_any by tring to open the path before writing the element