Issue #3374648 by zaporylie: Allow Drupal to handle releasing a lock via drupal_register_shutdown_function
Closes #3374648