finish player function