write tracks to file