Made the write functions return an error.

Instead of os.Exit(1), return an error and let the caller handle
the error. Somewhat cleaner.
JSON written file permission changed to 0644.

Removed weird fmt.Println of the *flagVersion.
Default timeout increased. Added ResultError type.

Default timeout is now 60 seconds instead of 10. The ResultError type is
some sort of wrapper around the error type itself, which implements the
MarshalJSON function from the json.Marshaler interface. This way an
error can be correctly marshaled.