Fixing server test to properly shutdown in case of failure