The sqlite3_backup_finish() function never fails, it just returns the
error code from previous operations. Previously if it returned an
error, the finalizer wouldn't be unset and sqlite3_backup_finish() would
be run again on an already-finished backup. This results in a
double-free and often segfaults.
The error handling is described in more detail in the "Error handling"
section of https://www.sqlite.org/backup.html.
This fixes the problem where when building with gccgo, sqlite3.c is
overwritten, leading to a build failure.
An alternative would have been to move sqlite3*.{c,h} to a subdirectory,
but that seems to confuse the linker a fair bit and would just swap one
implementation-dependent issue for another.
Closes#20
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>