Moved permission change before unlink.