So sorry you had this experience. It's always a hit to the wallet, ego and confidence.
I think there are many things you can do to avoid crashes like this, but ultimately, sometimes they "just happen." I have nothing that nears the investment you have, but I learned fairly early that I needed...