Diskpacked: add lazy (periodic) sync option

This syncPeriodSeconds option tells how often should
the written file Sync()ed.

If it is zero, then the old behaviour remains: Sync() after each and
every append.

If it is non-zero (seconds can be set in the config), then Sync() is
called periodically.

The default is 1 second.

Add s.writer.Close() to s.Close(), and call s.writer.Close() on every
change of s.writer (new pack file).

Change-Id: Ia12dee4343fa44724913fb8db4c73fce0bd0b432