fixed sonar bug closing statements