No court shall be opened on Sunday for any purpose other than to receive a verdict, give additional instructions to or discharge a jury; but this provision shall not prevent a judge of such court from exercising jurisdiction in any case where it is necessary for the preservation of the peace, the sanctity of the day, or the arrest and commitment of an offender.