add timeout before close