When setting ControlKeepAliveTimeout. FTPClient.__storeFile might fail when waiting for ack on ControlConnection.
While CSL is active, the ControlConnection timeout is set to 1 sec., if using default. This timeout value doesn't leave much room in terms of network/end point latency.
Replacing the code fragment above with the following fragment probably solves the problem (If proper ControlConnection timeout value is set):
One workaround is to set ControlKeepAliveReplyTimeout to a higher value.