Exit bitcoind gracefully in a bash script
Is bitcoin-cli available? If so, bitcoin-cli stop instead of pkill $BITCOIND_PID. 

My own preference is to add sleep 2 following a stop, as I've experienced issues immediately restarting the stopped daemon where it behaves like a child thread hasn't finished cleaning up before the parent exits. That may not be what's happening - I've not investigated that behaviour.