The command line client is not tracking whether a transaction is open on the client side.
As a consequence, a transaction may be partially committed if connection with server is lost when in interactive mode.
Let's consider this transaction:
If connection with server dies during the sleep, transaction is rolled back on server side, however when the 2nd insert is executed a new connection to the server is established and the insert is committed because the notion that the insert was part of a transaction is lost by the client.
Client should track transactions so that if connection to server is lost in the middle of a transaction, it will error out at next statement, instead of executing the transaction partially (by executing the remainder in autocommit mode).
This behaviour only happens in interactive mode, because in batch mode, even with the force flag, the client never ever reconnects to server if connection is lost.