Infinite loop in mutex dtor when backend is unavailable

master based version of this PR https://github.com/arvenil/ninja-mutex/pull/2