The most natural way that an NFC P2P link terminates is with some error caused by link disruption. For as long as both devices are in proximity, the communication will just continue with exchange of symmetry packets. This way either device may start other conversations as it wishes - SNEP (or beam) is not just the only thing.
Specifically for nfcpy's beam example, the way to terminate earlier is by Ctrl-C. Or to modify the example to terminate when the task is done.