Ensure writing gear logs fully closes