modify close of preview window