added safe close and pushing message to msg_broker