only close docs channel when not nil