(#693) Remove race conditions in autosigning code

This removes the autosigning attempt at signing all outstanding CSRs at
the same time, which removes contention between processes that are
submitting CSRs and then autosigning. It also properly locks and updates
the serial number file so that there is no more chance of duplicate serial
numbers.

In addition the `Puppet::Settings.(write|writesub|readwritelock)` are moved to
the appropriate `Puppet::Settings::BaseSetting` class and access to
manipulating the file specified as a setting is controlled there. These methods
are kept private to allow us to continue refactoring and finding better ways of
working with files.