Bluetooth PC power state controller

Hey there, sorry if this is in the wrong board I wasn't sure whether it was a hardware of software related problem, but I'm 90% sure it's hardware.

So currently I have a bluetooth module connected to my Arduino mega and once I send a command from my java android app my Arduino sends a 5v voltage to the switch to simulate the on switch on the computer to turn it on. It successfully turns it on, but then my pc turns off again after a few seconds as if I held the button in

if(val == 'n')
  {
    digitalWrite(computerOn, 1);
    delay(500);
    digitalWrite(computerOn, 0);
    val = ' ';
  }

That's the code to turn it on

If I pull the wire out before it has the chance to turn off, it stays on.

Thanks

Just thinking, does it need to be done with a transistor?