When a error occurs it is important to remove all the modifications done by the offending command and restore the value of dot to the state before of executing the command.
POSIX declares that dot is not modified by w commands