This is due to network delays. If you are using WiFI, this is common regardless of the connection speed. WiFi is very susceptible to weather and while your connections is x, the reality is something else.
You can simply wait and do it later, make a wired connection, or use another FTP client. I have to do this myself from time to time.
Publii uses a library to FTP, and while the library is very good, it is not as robust as a good FTP client. Not all FTPs are made equal.
When I get stuck, I use FileZilla and use server type .zip in Publii to simply create the files in your publii/site/output directory and stop. From there I use the Publii output directory as the source directory in FileZilla and upload everything to the server. FTP is simple, however, FTP clients can be intimidating. Don’t let this happen. Don’t be intimidated.