Time-resolved measurement of pulse-to-pulse heating effects in a terahertz quantum cascade laser using an NbN superconducting detector