Improper acclimation kills more fish than you think. Sounds like this was your situation. First, when trying to temp acclimate, you don't open the bag, just float it. Assuming that these fish were purchased from a local store, a 15 minute float will be long enough to temp adjust. THEN, open the bag to add water.
A better way to acclimate is a drip system. That is basically a bucket, a piece of airline tubing that will reach from your tank down to the bucket on the floor ( best place to put a bucket so it doesn;t spill
), an airstone and an adjustable valve. If your water temp in the bag is close to the temp of your tank, you can skip the float as the water as it drips into the bucket will adjust the water temp to what's in the tank. The next key is to drip water to a speed of approximately 1 drip per second. Use the valve to adjust the speed. The airstone is next. You want to aerate the water in the bucket but not too much as heavy aeration will alter the PH and possibly too rapidly for the fish. In colder water, you don;t need a lot of air. In warmer water you need more air. Observation will tell you if don;t have enough air going. If the fish is hyperventilating after being in the bucket for a few minutes, you will need to up the airflow just a bit. ( This is a case where more and a lot more is not always better
) If you are buying your fish and they are traveling a distance and are asleep and in cold water when you get them, you need to start everything slow and increase drip and airflow as the water warms and the fish wake up. What you are trying to ultimately achieve is to have the water in the bucket be 99% new water from your tank and 1% water from what the fish came in. The time frame for this changes based on the amount of water you start with. Again, 1 drop per second is a good flow rate to use.
Hope this helps. PM me if you have more questions