adds logic to finalize tracks and check for finalization