If you are trying to terminate a session while recording a udp stream you can invoke the run-time and stop-time options. The numbers are seconds i.e. 3600=1hour
e.g.
vlc udp://@yourstream --sout=file/ps:c:\folder\placetosavestream\test.mpg --run-time 3600 --stop-time=3600 vlc://quit