It's an unfortunate part of keeping fish. There many reasons why a fish can die suddenly, and sometimes you won't ever know the reason. I've bagged up perfectly healthy fish to take to a store, and they've died on the way. It sucks, but it's the tradeoff for the enjoyment you get from keeping them.