Prevent possible partial file when process killed.