Any witness required to enter into an undertaking, with or without security, shall, on failure or refusal, be committed to jail.