Gr.file_sink, want to end the sensing after a while

Hello all,

I am using the gr.file_sink() function to catch the raw data in GNC
platform. I have created a frequency list (with 10 frequncies) in a .txt
format and want to catch the raw data for each frequency. However, the
problem is, when the first frequency is selected, it continues to sense
the file gets bigger and bigger. The sensing does not stop
Probably I have to limit the sensing time so that after that time
the second frequency is automatically selected.
I dont know how to do that.
Any idea?