Time-of-flight spectroscopy of ultracold neutrons at the PSI UCN source