The standard caution usually appears in the instructions: 'To avoid loss of data do not turn off device or disconnect it.'
The receiving device needs to know where the final byte and final sector is, so it can close the file and list its place in the file allocation table.
The sending device has a protocol of checking that data can be sent, and that each byte was received free of errors. If it stops getting an answer back, it either generates an error or it freezes.