Photoswitching mechanism of a fluorescent protein revealed by time-resolved crystallography and transient absorption spectroscopy