Sounds like you just had a nightmare, everyone has them. No one knows what causes them, but if you were lucid, you might be able to get out of it.