Property for setting current filepath, automatically takes out lock on new file if not readonly db.

def filepath(self, value):
        """ Property for setting current filepath, automatically takes out lock on new file if not readonly db. """
        if not self.readonly and self._filepath != value:
            if self._locked:
                self.log.debug("Releasing previously-held lock file: {0}".format(self.lockfile))
                # Release the lock on previous filepath.
                self.release_lock()
            self._filepath = value
            if self._filepath is not None:
                self.acquire_lock()
        else:
            self._filepath = value