getting error while using HC05 bluetooth "ERROR-516 unable to write broken pipe"

I was trying to make a Bluetooth toy car but when I tried to send the commands form the app it gets disconnected from Bluetooth automatically and throws an ERROR-516 unable to write broken pipe but when I powered Arduino and the L293D shied individually it worked very perfectly.
How can I fix this?

  #include <AFMotor.h>
  #include <Servo.h> 
  #include <SoftwareSerial.h>

  SoftwareSerial bluetooth(A4,A5);

  AF_DCMotor motor1(1);
  AF_DCMotor motor2(2);
  AF_DCMotor motor3(3);
  AF_DCMotor motor4(4);
  Servo servo1;
  Servo servo2;

  void setup()
  {
   Serial.begin(9600);
   
   bluetooth.begin(9600);
   pinMode(A5,OUTPUT);
   pinMode(A4,INPUT);
   
   servo1.attach(9);
   servo2.attach(10);

   motor1.setSpeed(200);
   motor1.run(RELEASE);
   motor2.setSpeed(200);
   motor2.run(RELEASE);
   motor3.setSpeed(200);
   motor3.run(RELEASE);
   motor4.setSpeed(200);
   motor4.run(RELEASE);
  }

  void loop()
  {
   if( bluetooth.available()>0 )
    {
      int value = bluetooth.read();
      Serial.println(value);

       if( value >= 175 && value <=255 ) 
        {
          motor1.setSpeed(value);
          motor2.setSpeed(value);
          motor3.setSpeed(value);
          motor4.setSpeed(value);
        }

       switch(value)
        {
          case 10:
                servo1.write(0);
                break;
                
          case 13:
                servo1.write(100);
                break;

                
          case 20:
                motor1.run(FORWARD);
                motor2.run(FORWARD);
                motor3.run(FORWARD);
                motor4.run(FORWARD);
                break;
                
          case 19:
                motor1.run(BACKWARD);
                motor2.run(BACKWARD);
                motor3.run(BACKWARD);
                motor4.run(BACKWARD);
                break;
                
          case 16:
                motor1.run(BACKWARD);
                motor2.run(BACKWARD);
                motor3.run(FORWARD);
                motor4.run(FORWARD);
                break;  
          case 21:
                motor1.run(FORWARD);
                motor2.run(FORWARD);
                motor3.run(BACKWARD);
                motor4.run(BACKWARD);
                break;

       /*   case 18:
                motor1.setSpeed(value/2);
                motor2.setSpeed(value/2);
                motor1.run(FORWARD);
                motor2.run(FORWARD);
                motor3.run(FORWARD);
                motor4.run(FORWARD);
                break;                       */

          case 1:
                motor1.run(RELEASE);
                motor2.run(RELEASE);
                motor3.run(RELEASE);
                motor4.run(RELEASE);
                break;
          
        }
    }
  }

but when I powered Arduino and the L293D shied individually it worked very perfectly

what do you mean by that? seems to hint at a power issue.

By that I meanwhile using an L293D shield/extender-board we have an option that Arduino can be connected to PC and shield/extender-board can be powered by a battery
How can I resolve that "power issue"

can you describe exactly what is your setup. All the wires, all the powers, all the components?

share a clickable link also to your modules, like which L293D shield are you using?

Read the stickies at the top of the forum which tell you what information is included in a good post and how to post images etc.