Make shutdown of tests gracefully