Automatically close models when visiting their pages.