Judge refuses to free four Catalan leaders as elections near