Changed implementation to keep a swap file open at all times

clearing the swap file only when the kernel terminates