steal P5's unlink magic for windows, clear readonly flag when needed

When are file is meant to be deleted, and when we are have the privilegues
to clear the readonly flag, then we do that first before attempting to delete
the file. In case the file was not deleted we restore the original file flags.