Added code to close dialog post sending message.