Fish are sometimes tricky. Were these new fish? Fish that are sick already and introduced to a new environment tend to die off from the compounded stress. Did you recently clean the tank? Fish are extremely sensitive to cleaning residues. Did you dechlorinate the water? Most fish do best in water that's been sitting out for at least a day.