restoresession cleanup in patient tracker (#4355)