player: better cleanup code