Checked for null options on writeFile and readFile. Issue #6090

Checked for null options during writeFile and readFile functions. Will set encoding to default value if encoding is null. Issue #6090.