Saves TextGrid to the file. TextGrid may contain both interval and point
tiers (tg[[1]], tg[[2]], tg[[3]], etc.). If tier type is not specified in $type,
is is assumed to be "interval". If specified, $type have to be "interval" or "point".
If there is no class(tg)["tmin"] and class(tg)["tmax"], they are calculated as min and max of
all tiers. The file is saved in UTF-8 encoding.