Fixed potential logging bug

The logging module opens a new instance of the log file object every time
it's instantiated, without ensuring the last one is properly closed, leading
to potential memory holes and overwriting the log entries of other modules.

Signed-off-by: Eliminioa <crazymadgenius@gmail.com>