Replaced TemporaryFile by SpooledTemporaryFile