Use cleanup routines to remove POSIX semaphores instead of just blindly
unlinking them at the beginning of the testcase
This is a lot more intelligent in cleaning up the semaphores if the testcase
fails before sem_unlink is called.
Contributed back as bin/51872 upstream.