Imports are getting delayed midway (v5.1.0)

My software
My Mautic version is: v5.1.0
My PHP version is: v8.2
My Database type and version is: MySQL v8.0

My problem

While importing my 5.5k contact list into Mautic, the process gets stuck midway. It starts successfully but stops working after importing 2.9k contacts. I initially thought it might be an issue with the CSV file, but I checked it thoroughly and didn’t find any issues. The file is also UTF-8 formatted.

I checked the logs, and the only message I found was:

mautic.WARNING: Command mautic:import exited with status code 1

There are no other errors or helpful messages to troubleshoot the issue.

My VPS has 8GB of RAM and 4 cores, so I don’t believe this is related to server resources. Additionally, my cron jobs are running fine because the first 2.9k contacts are always imported successfully, but the process gets stuck at this point every time.

What could be causing this, and how can I fix it?