Make a check for keep-alive connections

Please, add curly brackets in "if" statement.