I feel I might be missing something, but theThe "canonical" continuous bijection should work hereworks. 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.
D.S. Lipham gave some more details in the comments for checking that the inverse is Baire class 1. We can directly show that $\tau^\omega$ maps open sets to $F_\sigma$-sets. Each basic open subset of $\mathbb{N}^\omega$ maps to a product of $F_\sigma$-subsets of $\mathbb{Q}$ whose factors are eventually all of $\mathbb{Q}^\omega$. Hence, the image is $F_\sigma$ in $\mathbb{Q}^\omega$. Each open subset of $\mathbb{N}^\omega$ is a countabe union of basic open sets, so its image is a countable union of $F_\sigma$-sets.