ensure that the copy process is properly terminated in case of client side or server side failures
by using conn#copy_data with a block instead of exec