I used the required input/output streams and closed them immediately after reading/writing.