Yes you're right, it should be:
```java
if (build.getResult() != Result.SUCCESS && repo.isAutoCloseFailedPullRequests()) {
   repo.closePullRequest(pull);
}
```