Close tmpfile() in Connection::put

Prevents crashes for scripts issuing high numbers (~990) of PUT requests