Close sockets in rpc tests
Close resources in pubsub tests
Get rig of resource leaks in pubsub tests
Refactor pubsub tests