Added cleanup of temp file if error or keyboard interrupt occurs during transfer.