Before the engine is switched off: $$P_{Initial rocket} = (m_{i}c, 0)$$
$$P_{photons} = (E/c, -p_{photons})$$
where E is the energy of the photons and ##p_{photons}## is the 3 momentum of the photons.
Rocket after engine switched off: $$P_{Final rocket} = (m_{f}c, m_{f}v)$$
By conservation of...