From the docs: "If it is less than 0 it will never automatically shutdown."

So in this case, a disconnect is just a disconnect, not a shutdown, so the code is correct.  Can you add a comment in there to we don't go scratching our heads again?