Added simple cleanup function to ensure close of the fifos at any level