Restore section protection bits after unpacking

Saves the protection bits to a variable that is no longer needed, then restores them after the unpacking completes.