close preview automatically