Gracefully stop logstash

I am currently running logstash script in the command prompt.
..\logstash\bin\logstash -f myconfig.conf

I have an output to two databases. What happens here is that If I were to run it with a static file as input the data will be written to the two DB correctly. If I were to run it with a file that is constantly overwritten as input I will have different row count on the two tables if I were to use CTRL + C to stop the logstash.

How can I shut it down such that it will complete the two write operation to the respective DBs before stopping?