i had a similar error on my iphone x when i was updating IOS using itunes. Phone went into recovery mode where it shows plug into itunes when i try to turn on the phone. When i plug it in, itunes would tell me there is an error, you can try updating or restoring your phone. But restoring will erase data. When i click update, it would extract software and once that was completed, the iphone turns off and on itunes it just shows "waiting for iphone". After a while error 4013 would appear.
these are the steps i did and managed to update the phone.
-unplug and turn off the phone.
-restart PC.
-TURN OFF all antivirus / windows defender / firewall / auto / real time protection.
-close all applications even the ones running in the background from taskbar.
-open itunes.
-turn on and plug in phone in different USB port.
-make sure your lighting cable is in good condition.
-click update. should work.
Thanks.