add clearing of message from tail node to avoid memory leaks when queue is empty and no new messages come