Do not make firstRun variable static

It looks like the emulator may reuse the same program instance after a
deinitialization. Part of fix for #4150.