Close tmpfile() in Connection::put

Prevents crashes for scripts issuing high numbers of put requests