Fixes #11 Refactored pubsub client to clean resources only after connection object is closed