That solution is useless performance wise, at least as I tested but it should work, provide full script. You get better performance without even enabling MT Mode for whole script than enabling it for 1 part and disabling it (practically what MT 5 does) for 2nd part.
But perhaps it gives another result with different type of video or bigger amount of drops. So I recommend to delete all SetMTMode lines.
Older Avisynth 2.5.8 is also slow even if using MT script with 50-60% fluctuating processor load so I'm not even sure if it actually uses multiple cores for 2nd part of script. I believe either script or Avisynth.dll should be changed for usingall CPU cores at max.
Just my observations because I spent hours on this single problem.
From Avisynth MT Wiki: * Mode 5 is slowest (slower than not using SetMTMode)