Use WRONLY for cmd_writer; Add blocking checks around lock_release()