Error 516:Unable to write:Broken pipe (Bluetooth)(Arduino)(MIT App Inventor)

I was trying to make this Arduino project where I would control a robotic arm using an app made with MIT App inventor via Bluetooth. I referred to the website- https://howtomechatronics.com/tutorials/arduino/diy-arduino-robot-arm-with-smartphone-control/ (blocks, and source code is there in the website)

The circuit, code all looks fine to me. The app consists of a slider controller, I move the robot arm based on the movement of slider controller.
The PROBLEM is that when I move the slider controller, the app crashes that is, it freezes and gives the following error- "Error 516:Unable to write:Broken pipe". I have observed that the bluetooth module(HC-05) I'm using starts disconnecting everytime I connect it, hence "broken pipe".

So, I would like to know is there any solution to fix it, if yes then please let me know it.

Thank You!

Hi.
It looks like something is causing the phone to disconnect from the HC-05. See what error you get if you remove power from the HC-05. There's also Error 515: Bluetooth not connected.

Check all the blocks in your app that call on Bluetooth client. Are you using the disconnect block anywhere?

A Bluetooth serial terminal app would be helpful. Do you have one installed on the phone?

John.