well, you got your destined accident out of the way, and now you've realized the potential of an accident, happens to pretty much everyone eventually, at least you were able to walk away and everything.
as for the cause, maybe not enough sleep or soemthing? i know i kind of daze off when i'm bored as shit in my car, never had it happen to me on my bike though, so i dunno.
either way, glad your ok