Ensure ports are closed when stubs are reset