Make sure the mutex unlocked before calling g_mutex_clear()