Replecament for closeallinput

This is a smart and simple replacement of closeallinput binary file