It might be old age. Because you dont know how old they are when you get them. Give me a while why I search to find out what it is and how to get rid of it.
It could be this:
Intestinal Worms
Symptoms:
Overall change in color, distended stomach, fish appears to be wasting away.
Treatment:
Jungle Internal Parasite Guard, Pepso Food, Formalin.
It also could be this because you said its tail was quite frayed:
Fin and Tail Rot
Symptoms:
Ragged look to end of fins and tail, Missing fins or disolving tail.
Treatment:
Erythromycin, Tetracycline, Furazone Green, or Triple Sulfa.
Not to sure if its this:
Air Bladder Disease
Some fishes with air bladder ailments will appear to settle on the bottom of the tank and make violent efforts to rise, only to settle down again. Others, called floaters, rise to the top of the tank and are unable to swim down. Students of fish diseases tell us that inflamed organs can reduce the size of the air bladder. Inflammation of the bladder wall also exerts a disastrous influence.
Treatment: Dissolve a teaspoonful of Epsom salts in a pint of water. Immerse the fish in it until it almost ceases its efforts to escape and lies exhausted. Then change the fish to a shallow container in which the water is not more than three times as deep as the fish is thick. Leave him in this water in which you have dissolved an antibiotic until he appears recovered.