Node Js Wait For File To Finish Writing