updated background service to close connection on exit; extended keepalive timeout