Fixed error with NamedTemporaryFile