Introduce proper connection closing in amqcommand.js