I take it that the app is closing normally?
If I were doing this, I would have the app send a message through the netlink socket back at the kernel module telling it to stop sending data when the user application receives the signal to terminate. (SIGTERM signal or closewindow events)
The sockets are bidirectional, so why not talk both ways?
Someone else might know a real answer to knowing when a process terminates, but it would be cleaner in my opinion not to hack it out like that.