only close files if no error was returned or else f.Close() will cause
a panic
adding in tests propery now for filemonitor usecases