How to fix ValueError: Semaphore released too many times in Python | DevErrors