asyncd: fix races in writing to spool

Add a simple lock to the file. It avoids mixing data that will disrupt the
parsing when reading it back by munin-update.