session regenerate race condition

Hello!
When two scripts simultaneously turning to session data, session id regeneration sometimes fails by "session_regenerate_id (): Session object destruction failed". This is a race condition. Maybe a recording session should be closed before regeneration?