windows: Move parts of the service code into its own file
Fix typos
windows: Keep console window open on exit if started by Explorer

This gives the user a chance to read the error message in case there is
one that hinders brickd to start correctly.
windows: Use correct exit code when reporting service stop

This allows the service manager to report a useful hint to the user
if the service could not be started properly.
windows: Use global mutex to ensure single instance behavior