Added error handling to the shared API state management

a2_add_api_user() and the various subsystem init calls it makes can now
return error codes, which should make the affected API calls fail in a
controlled fashion.

Also, a2_ResetDriverRegistry() and a2_UnregisterDriver() are now safe to
use without first opening a state or registering a driver.