You can use libbitcoin-node and libbitcoin-store to build your own node by following the libbitcoin-node pattern, or you can derive from libbitcoin-node and attempt to just use the header sync.
If the store terminates without clearing the flush lock file, the store files are corrupt. That’s the purpose of the flush lock, to detect store corruption and prevent use of a corrupt store, which would be undefined behavior.