Remove locks in case of SIGTERM.