Backs up the in-memory database to the file.
This method saves the current state of the in-memory database to the file specified in the constructor. If the database is not open, this method does nothing.
The backup is performed atomically by first writing to a temporary file (filename.new), verifying it was created successfully, then moving it into place.
After saving, the is_dirty flag is reset to false.