Try to acquire a specific lock, and then exit.
function system_test_lock_exit() {
  if (lock()
    ->acquire('system_test_lock_exit', 900)) {
    echo 'TRUE: Lock successfully acquired in system_test_lock_exit()';
    // The shut-down function should release the lock.
    exit;
  }
  else {
    return 'FALSE: Lock not acquired in system_test_lock_exit()';
  }
}