update for close flashes messages.

Also suitable for asynchronous messages.