Code to write final version of suffix tree