Improve modal closing.