can't receive any replies from Post request after several minutes

so i have a project that it always update to the Database. im using a Arduino uno wifi rev 2. so it is connected to a wifi then it connects to the host (which is my laptop/my server)

now, I'm simultaneously sending a post request to update my Database and also to get the status of two batteries from the database by using the reply of the post request and parsing the reply to get the data/value of it.

this is ALL of my ARDUINO code

#include <SPI.h>
#include <WiFiNINA.h>
#include <ArduinoJson.h>

int relayPin1 = 2;  //This is the Arduino Pin that will control Relay #1
int relayPin2 = 3;  //This is the Arduino Pin that will control Relay #2

int pressurePin = A0;
int force;
int ledPin = 5;
int num_steps;
int fsr = false;
int longfsr = false;
long buttonTimer = 0;
long longPressTime = 300;
int timer;
//char ssid[] = "SSID";                     // your network SSID (name)
//char key[]  = "Some password";                     // your network key  
char ssid[] = "SSID";                     // your network SSID (name)
char key[]  = "Some password";                     // your network key                           
//const char* host = "Some ip  add";          // server ip add
const char* host = "Some ip add";          // server ip add
int status = WL_IDLE_STATUS;                  // the Wifi radio's status
WiFiClient client;                            // initialize the client library
int portnum = 8080;                           // portn number
String line = "";
String reply_content = "";
String Battery_using = "";
StaticJsonBuffer<2000> jsonBuffer;


void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  pinMode(relayPin1, OUTPUT);
  pinMode(relayPin2, OUTPUT);
  pinMode(ledPin, OUTPUT);
  digitalWrite(relayPin1, HIGH);
  digitalWrite(relayPin2, HIGH);
//  while (!Serial) {
//    ; // wait for serial port to connect. Needed for Leonardo only
//  }


// attempt to connect to Wifi network:
Serial.print("[Attempting to connect to WEP network, SSID: ");
Serial.print(ssid);
Serial.println("]");

while ( status != WL_CONNECTED) {
Serial.println("[Connecting...]");
  
  status = WiFi.begin(ssid, key);

  // wait 5 seconds for connection:
  delay(5000);
 }

  // once you are connected :
  Serial.println("[Connection Succesful]");
  Serial.println();



}

void loop() {
timer++;
force = analogRead(pressurePin);


if(force > 600 ){
  
    if(fsr == false ){
      
      fsr = true;
      buttonTimer = millis();
      
   }

if ((millis() - buttonTimer > longPressTime) && (longfsr == false)) {
        //short pressed
        longfsr = true;
        num_steps += 1; 
     }
  
} else {

  if(fsr == true){

    if(longfsr == true){
      longfsr = false;
    } else {
      //long pressed
      
    }
  }
}

  delay(100);

if(timer==10){ 
update_data(num_steps);
Get_Data();
timer=0;
 }

if(Battery_using == "Battery_1"){
  digitalWrite(relayPin1, HIGH);
  digitalWrite(relayPin2, HIGH);
}else if (Battery_using == "Battery_2"){
  digitalWrite(relayPin1, LOW);
  digitalWrite(relayPin2, LOW);

}

}

//===================== Update Footsteps ======================  

boolean update_data(int steps){

String da = "data=";
String ta = String(steps);
String data = da+ta;

Serial.print("[Attempting to connect to ");
Serial.print(host);
Serial.println("]");

if (client.connect(host, portnum))
  {
    Serial.println("[Connected]");

    Serial.println("[Sending a request]");
    
    client.println("POST /Piezo_DLSL/function.php?action=update_footsteps HTTP/1.1");
    client.println("Host: "+ String(host));
    client.println("User-Agent: Arduino/1.0");
    client.println("Connection: close");
    client.println("Content-Type: application/x-www-form-urlencoded;");
    client.print("Content-Length: ");
    client.println(data.length());
    client.println();
    client.println(data); 

    Serial.println("[Request sent]");

Serial.println("[Response:]");
    while (client.connected() || client.available())
    {
      if (client.available())
      {
        char line   = client.read();
        reply_content = reply_content + line;
      }
    }

    Serial.println(reply_content);
    Serial.println();
    Serial.println("[End Of Response]");
    client.flush();    
    client.stop();
    Serial.println("\n[Disconnected]"); 
 
}else{
    Serial.println("[Connection failed!]");
    client.flush();
    client.stop();
  }     
}

//===================== Get Battery Data ======================  

boolean Get_Data(){  
String data = "data=Battery";
reply_content = "";

Serial.print("[Attempting to connect to ");
Serial.print(host);
Serial.println("]");

if (client.connect(host, portnum))
  {
    Serial.println("[Connected]");

    Serial.println("[Sending a request]");
    
    client.println("POST /Piezo_DLSL/function.php?action=Bat_update HTTP/1.1");
    client.println("Host: "+ String(host));
    client.println("User-Agent: Arduino/1.0");
    client.println("Connection: close");
    client.println("Content-Type: application/x-www-form-urlencoded;");
    client.print("Content-Length: ");
    client.println(data.length());
    client.println();
    client.println(data); 

    Serial.println("[Request sent]");
    Serial.println();
    Serial.println("[Response:]");
    
    while (client.connected() || client.available())
    {
      if (client.available())
      {
        
        char line   = client.read();
        reply_content = reply_content + line;
        if(reply_content.endsWith("Content-Type: application/json\r\n\r\n")){
           reply_content = "";
        }
      }
    }

  Serial.println(reply_content);

  Serial.println("[End Of Response]");
  Serial.println();    
  JsonObject& root = jsonBuffer.parseObject(reply_content);

  if (!root.success())
{
  Serial.print("[parseObject]");
  Serial.print("[ ");
  Serial.print(reply_content);
  Serial.println(" ] Failed");
  jsonBuffer.clear();
  client.flush();
  client.stop();

}else{
String json_value = root["status"];
Battery_using = json_value; 
  Serial.println("[Received Value]");
  Serial.println(json_value);

  jsonBuffer.clear();
  }
// while(client.connected()) {
     client.flush();
     client.stop();
//     delay(1000);
//     } 
    Serial.println("\n[Disconnected]"); 
 
}else{
    Serial.println("[Connection failed!]");
    client.flush();
    client.stop();
  }     
}

This is the last successful reply to me:

This is the part where it can't connect :

if this happens, it will be back to normal after several fail.

but if this happens. it can't received any response anymore. (stuck in this line)