Eng-6361: pass two extra parameters from engine to frontend

As you repeat these two lines of code a couple of times, you can move them into "cleanupExecutors" function, which is one line above.