Can't power down the Arduino GSM shield via digitalWrite

Powering the gsm shield from Arduino works fine on pin 7, which supposedly controls on / off.

The problem is trying to power it off. Whenever I call “digitalWrite(xyz, LOW);” it does power off the GSM shield. Very rarely does it actually work. Sometimes it does. I have played with a delays, without delays etc. If there is no delay(10000); for example, then it keeps looping on gsm off, but it doesn’t actually turn it off.

Does anyone know what is happening, and why my GSM modem is having problems turning off? I have it connected to a 12v so it has ample power. This is super frustrating because it’s supposed to be a simple function. Works perfectly fine turning it on.

const int gsm_power = 7; // digital pin 7 controls the power for the GSM Arduino modem
const int led=13;
const int pr= A0; 

int photo_val; // store photo value


void setup() {
pinMode(gsm_power, OUTPUT);
Serial.begin(9600);
pinMode(led,OUTPUT);
pinMode(pr, INPUT);
} 

void loop() {
photo_val = analogRead(pr);
if (photo_val > 250) {
digitalWrite(gsm_power, HIGH);
digitalWrite(led,HIGH); 
Serial.println("GSM ON");
Serial.println(photo_val);}

else if (photo_val < 250) {
digitalWrite(led,LOW); 
digitalWrite(gsm_power,LOW);
Serial.println("GSM OFF");
Serial.println(photo_val);
}}