Fix couple of issues related to bgp_server_test.

Following changes are implemented:

- Shutdown the TcpServer right away instead of doing it from Config task
- Tweak CloseDeferred test to work around a race condition in the test

Change-Id: I55f54c415f399a5cc7b1d0bd6743d24bd44cc06f