Ensure time when no writes happen

This PR changes the time option to use `setTimeout` to make sure that batches are emitted at least every `time` ms even though no writes are happening.