Fixed 1 NPE bug and the infamous Illegal State Exception after application is closed