need to close open file handles to temp files before attempting to delete them