Throw an exceptin if a specified file is not readable or writable
Fix the bug which uses the constant STDERR defined in only CLI mode