Its also possible that you might be reading too fast for your file write to keep up. In this case you can either slow down your acquisition, or write the datapoints to a temporary software buffer (like a queue) and write to the file in a separate thread.