MODBUS TCP: write_multiple_registers error

While implementing UR5e external MODBUS-TCP driver I faced a problem with writing multiple registers. Communication part of the driver is MODBUS client which successfully connects to controller(server) and gets correct answer for all MODBUS commands except write_multiple_registers. Server is closing the socket even if the length is zero or one. Fixing the problem with writing multiple registers will allow to send target joints position/velocities as one request. Driver has to split updating target position/velocity request for each joint for now.

MODBUS lib: GitHub - stephane/libmodbus: A Modbus library for Linux, Mac OS, FreeBSD and Windows (master build)
UR Software version: 5.0.5:30612