Flamethrowers are good for "close" fighting. Their disadvantage is that they can only be used at closer range than is usually the case for most other weapons.
In a normal combat operation, an enemy position will be reduced by shell and/or rifle fire to the point where there are few defenders. Usually, that was enough; the remaining defenders would either surrender or retreat, and in either event, the position would be carried.
Not so the Japanese. They would fight to the last man, which meant that the Americans had to kill them to the last man. Flamethrowers were good for this purpose because the flames, or at least the smoke, could permeate small holes that artillery, bullets, and even grenades could not, thereby killing with either fire or aphyxiation.
The dangers of using flamethrowers were lessened when there were few, isolated defenders, but not eliminated. A soldier hit in normal combat might have a chance of surviving; the carrier of a flamethrower would almost certainly die if his gas tank were hit, or he were hit in a way that caused him to lose control of his weapon. Plus, he would have to approach so close to use his weapon that an enemy that could get a shot at him would be firing at almost point blank range.