Now the battle ends properly when a pokemon is defeated