Pull closured functions out of normalizeStackTrace

[ci skip]