When the target file exists but its permission modes prevent us from opening it for writing, we can try first to chmod it and then open it.