Have restart act as one block (not two)

Aquire the open_close_lock when restarting
so that restarting appears as a single code
block when used in a threaded scenario.