The spectral theorem for quaternionic unbounded normal operators based on the S-spectrum