Why do you need to "kill -9"? A simple kill should work and will allow the process to terminate cleanly (save existing state, etc.) rather than just terminating it abruptly. It might be best to make sure you get the correct firefox PID, just in case there are multiple copies running (e.g. using different user accounts. A generic script to do this would be something like:
sleep 30 # replace 30 with number of seconds to sleep
sleep 5 # give it some time to die
kill -9 $progpid >& /dev/null # make sure it's dead.
Edit to add: you could make this script more robust by adding alarm signals in conjunction with wait to trap and see if the child process exits before the timer runs out. See this page
for the basic idea.