Revert "releaseDetach that never detaches the semaphore"

This reverts commit c352259a48d8176304a3dd77e2811cde1da6a144.
Fixing a bug with releaseDetach that never detaches the semaphore

releaseDetach was always adding to number of attached permits, when it
should be decrementing it. The permits delta required for attachDetach
is always the negated number of permits that you're releasing on the
semaphore.