The problem with the script you are using is that you are powering off the board and then you are going to configure the pin but the Module will be already off for configuring the pins. If the poweroff process is running in parallel to the configuration of the pins, as you can see in the Terminal Console after running the command poweroff the board partially boots in this process there could be changes in the pins so if the pin is high after this it could be low again.
My suggestions will be using the same idea but with inverted logic, I mean:
You can create a startup script to set the gpio49 as high and have external circuitry with an inversor + capacitor + ... This will allow you to have a trigger when the poweroff process finishes.