Update tar.go

If os.OpenFile(...) returns err != nil, f will be nil. So f.Close() would cause a "nil pointer dereference".
Merge pull request #308 from gprggr/tar

pkg/tar: fixing possible nil pointer dereference