postgresql bgworker SIGTERM handler called twice
This is because pkill sends the signal to all processes that match the given name, and Postgres is multi-threaded.

Use regular kill with the process ID of the background process that you wish to nuke.