graceful_exit() needs to call exit when it's done, otherwise the script might continue after.
Also, upon normal finishing, remove the lockfile before calling graceful_exit().