Fix write() for session_regenerate_id(TRUE)

Switching the if statements, because destroy() already removed the lock.