cifs: move rename and delete-on-close logic into helper function