Check was not done to see if it was possible to write to the file, when writing to the file. This should now prevent crashing if the file is not able to be written to, at the time the writing is performed.
Added comment defining failure condition for VSError.
Note: inconsistent checks of error condition are present. (>Ok vs <= Ok), which may cause consistency issues in the future.