Detection of leaks in membrane apparatus or modules