Fix leaking FD

See #1289 
Please investigate whether these can be replaced with calls to: http://golang.org/pkg/io/#Copy