TEST: add test code to trap shutdown issue