I feel I might be missing something, but the "canonical" continuous bijection should work here. We start by observing that $\mathbb{P}$ is homeomorphic to $\mathbb{N}^\omega$. We pick some bijection $\tau : \mathbb{N} \to \mathbb{Q}$, which is trivially continuous, and has a Baire class 1 inverse. We can then lift $\tau$ to obtain a continuous bijection $\tau^\omega : \mathbb{N}^\omega \to \mathbb{Q}^\omega$ with Baire class 1 inverse $(\tau^\omega)^{-1}$. As $(\tau^\omega)^{-1}$ is Baire class 1, the preimage of a closed set under it is $\Pi^0_2$, hence $\tau$ maps closed sets to $\Pi^0_2$-sets as desired.