In the first case the infinitive would be wrong. The "to" here is an ordinary preposition, and requires either a noun or a gerund:
"...how close you've just come to disaster"
"...how close you've just come to killing yourself"
Your second example is problematic, because it seems to me completely wrong. That is, you are right in thinking that this should be an infinitive. The gerund here is ungrammatical.
Interested in Language