tstools: calcEnd corrections

-use temporary variables for getLastFrame and fixupPTS,
current values might be invalidated when the function
fails, in which case we should stick to our previous
values

-m_offset_end should not change without m_pts_end, they
are always used as a pair

issues reported by betacentauri