Cleanup Semaphore implementation