refs.c: make close_ref() and commit_ref() non-static