Moved terminate_idles_sessions into context.c since it is purely manipulating