So, because your iPhone continues to be frozen after all those attempts to unfreeze it you made a decision to put gadget into Recovery Mode which allows to flash a genuine firmware version greater than (if available) or equal to a current one. You have followed all relevant instructions but got new problem that is iPhone stuck in Recovery Mode with iTines message "unknown error 9". Don't panic, change can come quickly and easily because for now on you know what is the matter with iPhone as error 9 is not software but hardware related problem particularly with its Flash memory chip namely Samsung 843 K9MDG0805M. Replace it to fix error 9 on iPhone.
If you are not up to self repair use any send-in iPhone repair service to restore your iPhone.