Check for semaphore max value.

As discussed in issue #2, we want to fail hard if we release a semaphore more than its initial value.