There most likely wasn't anything you could have done. Sometimes, especially when they are young, they could have health problems that are incompatible with life and not your fault. My daughter had a corn snake that passed suddenly when it was just couple of months old. I'm sorry it had to happen to you but it WASN'T YOUR FAULT, I'm sure.
*hugs*