How to handle -0x7880 correctly?

hi,

I have a working mbedtls FTPS client implementation. However, as soon as the file transfer over the data connection finished, the server (vsftpd) terminates the data connection and the client prints MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY (-0x7880) errors:

tls                 : error  : [2021/09/15 18:26:32.820] [id =      6]: ../../src/../externals/mbedtls/mbedtls/library/ssl_tls.c(4369): mbedtls_ssl_handle_message_t
ype() returned -30848 (-0x7880)

tls                 : error  : [2021/09/15 18:26:32.820] [id =      7]: ../../src/../externals/mbedtls/mbedtls/library/ssl_tls.c(8335): mbedtls_ssl_read_record() returned -30848
 (-0x7880)

The file transfer however finished correctly and the data was written to a file as expected. How should this be handled correctly so that these messages do not appear? Why are they marked “error”?
I think the server terminating the connection after successful data transmission is correct behavior, is it not?

Double posted on tls1.2 - How to handle -0x7880 correctly in mbedtls client? - Stack Overflow and will make sure to keep replies in sync between the two threads!

This may be a duplicate topic to the link on stackoverflow, but there’s not really a helpful answer to find there!!??
I’ve got a similar problem during Client State 8 (write client key exchange)…

Core/Src/MbedTLS/ssl_tls.c:2496: ssl->f_send() returned -30848 (-0x7880)
…/Core/Src/MbedTLS/ssl_tls.c:2918: mbedtls_ssl_flush_output() returned -30848 (-0x7880)
…/Core/Src/MbedTLS/ssl_cli.c:3068: mbedtls_ssl_write_record() returned -30848 (-0x7880)
…/Core/Src/MbedTLS/ssl_tls.c:6764: <= handshake

ERROR: net_sock_open_mbedtls L#359 failed
! mbedtls_ssl_handshake returned -0x7880

Any help would be appreciated.