release semaphore automatically on request end