Checking the cause of SFTP down after the successful connection. Upon investigation, After passing the credentials to SFTP there was a loading to get the directory information that delays the connection. add ping check to the script after connecting, if the system can ping the sftp while connection we will continue to send the file else we need to re-connect the connection.