Fixed message loss on close issue