Most of the methods to achieve
fix close_file bug