Investigation of organic solid-state chemical reaction by terahertz spectroscopy