Test that shutdown callback is called when expected.