You can't access the database directory from two different processes at the same time. This isn't a code-level concern, just an operational concern.
You'd have to:
- Shutdown your application (thereby releasing the lock)
- Run a backup using Neo4j tooling (of your choice)
- Start your application back up again
For "live" backups without shutting down your application, you'd need to run a cluster using Neo4j Enterprise.
Cheers, Andreas