First, you should make maximum use of pillar 3a. This is because the deductible contributions do not add up, but expire at the end of the year. On the other hand, possible pension fund purchases do not expire. You can also close any existing gaps in the pension fund in the following year.
Note that pension fund purchases three years before retirement have an impact on how you will be permitted to withdraw your pension fund assets. Specifically, in this case, you will be required to withdraw your balance as a pension. In the event of a lump-sum withdrawal, the tax saved on the purchase is reclaimed.