Added write case to page switch and added try catch in the write_end case in thread_controller.php.
Added views/thread/write.php.