Close uploaded file on bad filenames too