Fixed an issue where the mutex released slightly too early