making sure that scratch file is deleted