fix data races around use of l.closed

fixes #1