Do I need to be retired to use the Maine pension deduction?

I know there is a non military State of Maine deduction of $45,864 for withdrawal of a pension, but do you need to be retired ? Can you still be working and take a withdrawal from a 401k and use the State of Maine deduction?