Fix: Add shebang
Fix: Close file before return
Fix: Mismatched new/delete
Fix: remove unnecessary check