Fix lock leak in notifysemaphore.Close()