You can fix the can't open file for writing in three ways: Check File Permissions Check If the File Is Locked Check for Read-only Memory