Remade the activity termination to work with a PID file instead of a LOCK file. Added a propper PID file cleaning.